www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15629] New: [REG] wrong code with "-O -inline" but correct

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

          Issue ID: 15629
           Summary: [REG] wrong code with "-O -inline" but correct with
                    "-O"
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: gassa mail.ru

Here is the reduced test case.

testmodule.d:
-----
import std.math;
import std.stdio;

void main ()
{
    int [] a = [3];
    int [] b = [9];
    int value = abs (a[0]);
    if (a[0] != 3)
    {
        writeln (value, " ", a, " ", b);
        assert (false);
    }
}
-----

DMD 2.066.1 through the latest DMD 2.070.0:
- "dmd -O testmodule.d" works,
- "dmd -O -inline testmodule.d" writes "3 [3] [9]" and runs into assert
(false).
DMD 2.063.2:
- both work as expected.

So, technically, this is a regression somewhere between 2.063.2 and 2.066.1.

--
Jan 30 2016