Created attachment 1851
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
Comment #1 by bugzilla — 2022-05-29T06:49:47Z
Reduced it to:
struct S
{
int depthLow = 0;
int depthHigh = 30000;
void fun(int* pixels)
{
float b = depthLow;
int depthA = cast(int)(b);
int depthB = cast(short)(cast(float)depthHigh * cast(float)depthLow);
pixels[depthA] = depthB;
}
}
compile with -O
Comment #2 by dlang-bot — 2022-05-29T19:37:21Z
@WalterBright created dlang/dmd pull request #14174 "fix Issue 23076 - SIMD assert fail with -inline -O converting float t…" fixing this issue:
- fix Issue 23076 - SIMD assert fail with -inline -O converting float to short
https://github.com/dlang/dmd/pull/14174
Comment #3 by dlang-bot — 2022-05-29T23:49:00Z
dlang/dmd pull request #14174 "fix Issue 23076 - SIMD assert fail with -inline -O converting float t…" was merged into master:
- 99e10f87d12cac36db27d2b86d6d2ef116f3f59c by Walter Bright:
fix Issue 23076 - SIMD assert fail with -inline -O converting float to short
https://github.com/dlang/dmd/pull/14174