As reported https://github.com/dlang/dmd/pull/12466#issuecomment-826404674
Followup to https://issues.dlang.org/show_bug.cgi?id=20460
it's actually quite easy to reproduce, but you need two modules at least.
module test20460a;
import test20460b;
void main ()
{
foo(); // L7
}
int bar ()
{
throw new Exception("Hello"); // L12
}
module test20460b;
import test20460a;
void foo ()
{
// Some comment so that the call is at L8
bar();
}
Currently, if I try to compile and run this (with upstream DMD):
% dmd --version
DMD64 D Compiler v2.096.0
Copyright (C) 1999-2021 by The D Language Foundation, All Rights Reserved written by Walter Bright
% dmd -g test20460a.d test20460b.d
% ./test20460a
[email protected](12): Hello
----------------
test20460a.d:12 int test20460a.bar() [0x108407227]
test20460a.d:13 void test20460b.foo() [0x108407238]
test20460a.d:7 _Dmain [0x1084071ac]
Notice that multiple things are wrong:
Only test20460*a*.d shows up in the trace, but the second frame is in test20460*b*.d;
Except for the first (the one in main), line number are wrong;
Comment #1 by bugzilla — 2021-04-28T10:09:06Z
If it is compiled like so:
dmd -g -c test20460b
dmd -g test20460a test20460b.o
it produces the correct output when run.
Comment #2 by robert.schadek — 2024-12-13T19:15:57Z