Bug 17657 – wrong line number when optimized (dmd -O -g)

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2017-07-16T17:03:51Z
Last change time
2023-05-11T11:22:42Z
Assigned to
No Owner
Creator
kdevel

Comments

Comment #0 by kdevel — 2017-07-16T17:03:51Z
Wrong linenumer is reported for this code linenonullable.d --- 1 import std.stdio; 2 import std.typecons; 3 4 void main () 5 { 6 Nullable!int i; 7 if (i.isNull) { 8 "X".writeln; 9 int j = i; 10 } 11 } When compiled with dmd -g the output is X core.exception.AssertError@[...]: Called `get' on null Nullable!int. ---------------- [...] linenonullable.d:9_Dmain [0x4456eb] [...] when compiled with dmd -O -g I get [...] linenonullable.d:7 _Dmain [0x4456eb] [...] Expected: Same lineno. as in the unoptimized case is reported.
Comment #1 by dlang-bugzilla — 2017-07-17T06:34:50Z
Err, I think using optimizations implies that you are willing to sacrifice accurate debug information. This is true for pretty much all compilers, so unless this is something easily fixable, I'm not sure if this is a valid bug report.
Comment #2 by razvan.nitu1305 — 2023-05-11T11:22:42Z
I cannot reproduce this. I am still getting the correct line number when compiling with -g -O using the latest compiler version.