www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20382] New: Bad call stack with scope(success)

https://issues.dlang.org/show_bug.cgi?id=20382

          Issue ID: 20382
           Summary: Bad call stack with scope(success)
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: goalitium dissues.mail.kapsi.fi

import std.stdio;

void throws()
{
        throw new Exception("hello world"); // should break here
}

void main()
{
        scope(success)
                writeln("hi");
        throws(); // breaks here instead
}

This following program when built with debug symbols (-g -m64) and debugged
with VC++ debugger, does not correctly break at the exception, but instead in
the main function where throws is called. Possibly related to issue 15190.

Another issue with this code but without the scope(success) block, the debugger
breaks in the object.Exception's constructor, which is also wrong, it should
break at the line where throw is issued. Regressed in 2.086.0/1.

stack trace:
object.Exception source\app.d(5): throws
----------------
0x00007FF64D20DCBC in app.throws at
C:\D\dmd2\windows\bin\..\..\src\druntime\import\object.d(1975)
0x00007FF64D20DD00 in D main at C:\Users\GoaLitiuM\AppData\Local\Temp\New
folder (6)\test\source\app.d(12)
0x00007FF64D2157B3 in void rt.dmain2._d_run_main2(char[][], ulong, extern (C)
int function(char[][])*).runAll().__lambda1()
0x00007FF64D2155EC in void rt.dmain2._d_run_main2(char[][], ulong, extern (C)
int function(char[][])*).tryExec(scope void delegate())
0x00007FF64D2156EB in void rt.dmain2._d_run_main2(char[][], ulong, extern (C)
int function(char[][])*).runAll()
0x00007FF64D2155EC in void rt.dmain2._d_run_main2(char[][], ulong, extern (C)
int function(char[][])*).tryExec(scope void delegate())
0x00007FF64D21543D in d_run_main2
0x00007FF64D20F8D0 in d_run_main
0x00007FF64D20DDB2 in app._d_cmain!().main at
C:\D\dmd2\windows\bin\..\..\src\druntime\import\core\internal\entrypoint.d(34)
0x00007FF64D273A9C in __scrt_common_main_seh at
d:\agent\_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl(288)
0x00007FF9278C7BD4 in BaseThreadInitThunk
0x00007FF92810CED1 in RtlUserThreadStart

--
Nov 10 2019