http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57875
Bug ID: 57875
Summary: wrong code at -O2 on x86_64-linux-gnu in 32-bit mode
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: su at cs dot ucdavis.edu
The current gcc trunk mis-compiles the following code on x86_64-linux at -O2 in
32-bit mode. This is a regression from 4.8.x.
$ gcc-trunk -v
gcc version 4.9.0 20130710 (experimental) [trunk revision 200864] (GCC)
$
$ gcc-trunk -m32 -O2 small.c
$ a.out
1
$ gcc-trunk -m32 -O1 small.c
$ a.out
0
$ gcc-trunk -m32 -O3 small.c
$ a.out
0
$ gcc-4.8 -m32 -O2 small.c
$ a.out
0
$
----------------------------------------------------
int printf (const char *, ...);
int a[1], b, c, d, f, i;
char e[1];
int
main ()
{
for (; i < 1; i++)
if (!d) {
if (!c)
f = 2;
e[0] &= f ^= 0;
}
b = a[e[0] >> 1 & 1];
printf ("%d\n", b);
return 0;
}