[Bug tree-optimization/61931] Wrong Constant Folding
ishiura-compiler at ml dot kwansei.ac.jp
gcc-bugzilla@gcc.gnu.org
Thu Dec 18 07:56:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61931
--- Comment #2 from Ishiura Lab Compiler Team <ishiura-compiler at ml dot kwansei.ac.jp> ---
We are sorry for having reported an error program with undefined behavior.
We have redone minimization. The resulting program is as follows.
$ cat test.c
int a = 1;
int b = 0;
int c = 1;
int d = 1;
long long e = 2LL;
long long f = 1LL;
unsigned long long g = 0xFFFFFFFFFFFFFFFFLLU;
int main (void)
{
int h = 1;
int i = (1 / a) - 1;
int j = h << (i <= 1U);
long long k = 1LL << (g + 3LLU);
long long l = k >> 1;
long long m = (b | l) / 3;
long long n = (a - m) | 1;
long long o = 1 - ((0 | n) ^ j);
long long p = 1 | (3 * f);
long long q = p << (a <= 0);
long long r = (e & 2) % 3;
c = r <= (q || d);
long long s = (1LL % d) * a;
if (o != -2LL) __builtin_printf ("o = %lld\n", o);
if (s != 0LL) __builtin_printf ("%lld", 0LL);
return 0;
}
$ arm-none-eabi-gcc-4.8.4 test.c -o test.out -O2 --specs=rdimon.specs
$ qemu-arm -L /usr/arm-linux-gnueabihf/ ./test.out
o = 164686225997822
$ arm-none-eabi-gcc-4.8.4 test.c -o test.out -O1 --specs=rdimon.specs
$ qemu-arm -L /usr/arm-linux-gnueabihf/ ./test.out
More information about the Gcc-bugs
mailing list