[Issue 21474] ICE with core.simd and -O ("Illegal Instruction")
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Dec 17 22:48:31 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=21474
mhh <maxhaton at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |maxhaton at gmail.com
--- Comment #3 from mhh <maxhaton at gmail.com> ---
(In reply to ponce from comment #1)
> Found this bug another time in another incarnation.
>
> Build with dmd -O for reproducing.
>
>
> --------- test4.d -------------
>
> import core.simd;
>
> int4 cmpss_repro(float4 a)
> {
> int4 result;
> result.ptr[0] = (1 > a.array[0]) ? -1 : 0;
> return result;
> }
>
> -------------------------------
This particular example yields the output
---
findreg(0, line=751, file='src/dmd/backend/cod4.d', function =
'_D5dtest11cmpss_reproFNhG4fZNhG4i')
dmd: src/dmd/backend/cgcod.d:1864: Assertion `0' failed.
---
The function in question:
-------------------
reg_t findreg(regm_t regm, int line, const(char)* file)
{
debug
regm_t regmsave = regm;
reg_t i = 0;
while (1)
{
if (!(regm & 0xF))
{
regm >>= 4;
i += 4;
if (!regm)
break;
}
if (regm & 1)
return i;
regm >>= 1;
i++;
}
debug
printf("findreg(%s, line=%d, file='%s', function =
'%s')\n",regm_str(regmsave),line,file,funcsym_p.Sident.ptr);
fflush(stdout);
// *(char*)0=0;
assert(0);
}
-------------------
On the assumption that dmd builds are distributed after being compiled with
ldc, ldc (possibly dmd as well) will optimise an assert(0) to a x86 ud2
instruction.
--
More information about the Digitalmars-d-bugs
mailing list