www.digitalmars.com         C & C++   DMDScript  

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

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 puremagic.com
          Reporter: kdevel 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.

--
Jul 16 2017