http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58228
Bug ID: 58228 Summary: wrong code (with vectorization?) at -O3 on x86_64-linux-gnu Product: gcc Version: unknown 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, as well as gcc 4.7 and 4.8, produces wrong code for the following testcase on x86_64-linux when compiled at -O3 in both 32-bit and 64-bit modes. This is a regression from 4.6.x. This seems to do with vectorization, as it goes away with -fno-tree-vectorize. $ gcc-trunk -v gcc version 4.9.0 20130822 (experimental) [trunk revision 201915] (GCC) $ gcc-4.6 -O3 reduced.c $ a.out 1 $ gcc-4.7 -O3 reduced.c $ a.out 0 $ gcc-4.8 -O3 reduced.c $ a.out 0 $ gcc-trunk -O3 reduced.c $ a.out 0 $ gcc-trunk -O3 -fno-tree-vectorize reduced.c $ a.out 1 $ -------------------------------------------- int printf (const char *, ...); int a[8][8] = {{1}}; int b, c, d, e; int main () { for (c = 0; c < 8; c++) for (b = 0; b < 2; b++) a[b + 4][c] = a[c][0]; printf ("%d\n", a[4][4]); return 0; }