https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71518
Bug ID: 71518 Summary: wrong code at -O3 on x86_64-linux-gnu in 64-bit mode (not in 32-bit mode) Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- The current gcc trunk and 6.1.x miscompile the following code on x86_64-linux-gnu at -O3 in the 64-bit mode (but not in the 32-bit mode). This is a regression from 5.4.x, and goes away with -fno-tree-vectorize. $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/usr/local/gcc-trunk --disable-bootstrap Thread model: posix gcc version 7.0.0 20160612 (experimental) [trunk revision 237336] (GCC) $ $ gcc-trunk -m32 -O3 small.c; ./a.out $ gcc-trunk -m64 -O2 small.c; ./a.out $ gcc-5.4 -O3 small.c; ./a.out $ $ gcc-trunk -m64 -O3 small.c $ ./a.out Segmentation fault (core dumped) $ $ gcc-6.1 -m64 -O3 small.c $ ./a.out Segmentation fault (core dumped) $ -------------------------------- int a, *b[9], c, d, e; static int fn1 () { for (c = 6; c >= 0; c--) for (d = 0; d < 2; d++) { b[d * 2 + c] = 0; e = a > 1 ? : 0; if (e == 2) return 0; } return 0; } int main () { fn1 (); return 0; }