[Bug tree-optimization/68963] [4.9/5/6 Regression] O3 vs. O2 discards part of loop and terminates early
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Dec 21 09:52:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68963
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Adjusted testcase for testsuite purposes:
static const float a[3] = { 1, 2, 3 };
int b = 3;
__attribute__((noinline, noclone)) void
bar (int x)
{
if (x != b++)
__builtin_abort ();
}
void
foo (float *x, int y)
{
int i;
for (i = 0; i < 2 * y; ++i)
{
if (i < y)
x[i] = a[i];
else
{
bar (i);
x[i] = a[i - y];
}
}
}
int
main ()
{
float x[10];
unsigned int i;
for (i = 0; i < 10; ++i)
x[i] = 1337;
foo (x, 3);
for (i = 0; i < 10; ++i)
if (x[i] != (i < 6 ? (i % 3) + 1 : 1337))
__builtin_abort ();
return 0;
}
More information about the Gcc-bugs
mailing list