www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23076] New: [ICE][backend][REG] Crash with -inline -O

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

          Issue ID: 23076
           Summary: [ICE][backend][REG] Crash with -inline -O
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: aliloko gmail.com

Created attachment 1851
  --> https://issues.dlang.org/attachment.cgi?id=1851&action=edit
main source

DMD32 D Compiler v2.100.0-beta.1-dirty


Please consider the following program:

------------------ main.d --------------------------

float mul3(float a, float b, float t)
{
    return t * b * a;
}

class A 
{
    ushort depthLow = 0;
    ushort depthHigh = 30000;

    void fun(short* pixels)
    {
        short depthA = (cast(short)(mul3(depthHigh, depthLow, 0)));
        short depthB = (cast(short)(mul3(depthLow, depthHigh, 0)));
        pixels[depthA] = depthB;
    } 
}

-----------------------------------------------------

You may now crash the compiler with the following build command:
    $ dmd -m64 -inline -O -w main.d


This is a regression, no ICE with dmd.2.099.1

--
May 01 2022