[Issue 17657] New: wrong line number when optimized (dmd -O -g)

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Jul 16 10:03:51 PDT 2017


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

          Issue ID: 17657
           Summary: wrong line number when optimized (dmd -O -g)
           Product: D
           Version: D2
          Hardware: Other
                OS: Other
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: kdevel at vogtner.de

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.

--


More information about the Digitalmars-d-bugs mailing list