[Bug target/84524] -O3 causes behavior change
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Feb 23 08:51:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84524
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-02-23
CC| |jakub at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Adjusted testcase for the testsuite:
void
foo (unsigned short *x)
{
unsigned short i, v;
unsigned char j;
for (i = 0; i < 256; i++)
{
v = i << 8;
for (j = 0; j < 8; j++)
if (v & 0x8000)
v = (v << 1) ^ 0x1021;
else
v = v << 1;
x[i] = v;
}
}
int
main (void)
{
unsigned short a[256];
foo (a);
for (int i = 0; i < 256; i++)
{
unsigned short v = i << 8;
for (int j = 0; j < 8; j++)
{
asm volatile ("" : "+r" (v));
if (v & 0x8000)
v = (v << 1) ^ 0x1021;
else
v = v << 1;
}
if (a[i] != v)
__builtin_abort ();
}
return 0;
}
I can confirm this is miscompiled even with current trunk at -O3 -mavx512bw.
More information about the Gcc-bugs
mailing list