D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20382 - Bad call stack with scope(success)
Summary: Bad call stack with scope(success)
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Windows
: P3 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-10 22:23 UTC by GoaLitiuM
Modified: 2024-12-13 19:06 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description GoaLitiuM 2019-11-10 22:23:51 UTC
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
Comment 1 dlangBugzillaToGithub 2024-12-13 19:06:08 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19639

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB