http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57300
Bug ID: 57300 Summary: statement in expression miscompiled at -O3 in 32-bit mode Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: dhazeghi at yahoo dot com The following testcase appears to be miscompiled with gcc 4.8 and trunk on x86_64-linux-gnu at -O3 optimization level in 32-bit mode. In 64-bit mode, at lower optimization, or with gcc 4.7 and earlier it works correctly. $ gcc-trunk -v Target: x86_64-unknown-linux-gnu ... gcc version 4.9.0 20130515 (experimental) [trunk revision 198926] (GCC) $ gcc-trunk -O2 -m32 small.c $ ./a.out 1 $ gcc-trunk -O3 -m64 small.c $ ./a.out 1 $ gcc-4.7 -O3 -m32 small.c $ ./a.out 1 $ gcc-trunk -O3 -m32 small.c $ ./a.out 0 $ ------------------------------ int printf (const char *, ...); int a, b, e; long long c; int d[10]; int main () { int *f = &a; e = 0; for (; e < 10; e++) d[e] = 1; if (d[0]) c = ( { int g = *f = ( { b == 0 || 1 % b; }); g; } ); printf ("%d\n", a); return 0; }