www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13998] New: Wrong code with -O -inline, loops, and taking

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

          Issue ID: 13998
           Summary: Wrong code with -O -inline, loops, and taking address
                    of double
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Keywords: wrong-code
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: thecybershadow gmail.com

////////////////////////// test.d /////////////////////////
void main()
{
    static ulong repr(double d) { return *cast(ulong*)&d; }
    double[] arr = [3.0];
    foreach (x; arr) assert(repr(arr[0]) == repr(arr[0]));
}
///////////////////////////////////////////////////////////

Assert is triggered when built with -m64 -O -inline.

Might not be reproducible 100% of the time.

Introduced in https://github.com/D-Programming-Language/dmd/pull/3620

--
Jan 17 2015