http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57569
Bug ID: 57569 Summary: wrong code for struct copy at -O3 on x86_64-linux 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 code is miscompiled with current gcc-trunk on x86_64-linux at -O3 optimization level in 32-bit mode, outputting garbage (rather than 0). This is a regression from 4.7. $ gcc-trunk -v gcc version 4.9.0 20130608 (experimental) [trunk revision 199849] (GCC) $ gcc-trunk -O2 -m32 reduced.c $ ./a.out 0 $ gcc-4.7 -O3 -m32 reduced.c $ ./a.out 0 $ gcc-trunk -O3 -m32 reduced.c $ ./a.out 134519796 ---------------------------- int printf (const char *, ...); struct S { int f0; } a; int b, e, *d = &b, f; void fn1 () { int **g[9][6]; int ***h = &g[6][3]; for (; e < 9; e++) { f = 0; for (; f < 6; f++) g[e][f] = &d; } ***h = 0; } void fn2 () { fn1 (); struct S c[4][10] = {}; a = c[3][9]; } int main () { fn2 (); printf ("%d\n", a.f0); return 0; }