https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68755
Bug ID: 68755 Summary: wrong code at -O3 on x86_64-linux-gnu (in 32-bit mode) Product: gcc Version: 5.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- The current gcc 5 branch miscompiles the following code on x86_64-linux-gnu at -O3 in the 32-bit mode (but not in the 64-bit mode). It does not seem to impact the mainline. $ gcc-5-branch -v Using built-in specs. COLLECT_GCC=gcc-5-branch COLLECT_LTO_WRAPPER=/usr/local/gcc-5.3.1-branch/bin/../libexec/gcc/x86_64-unknown-linux-gnu/5.3.1/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc-5.3-branch/configure --enable-languages=c,c++ Thread model: posix gcc version 5.3.1 20151206 [gcc-5-branch revision 231343] (GCC) $ $ gcc-5-branch -m32 -O2 small.c; ./a.out $ gcc-5-branch -m64 -O3 small.c; ./a.out $ gcc-trunk -m32 -O3 small.c; ./a.out $ $ gcc-5-branch -m32 -O3 small.c $ ./a.out Segmentation fault (core dumped) $ --------------------------------------- int printf (const char *, ...); int a, b; short c, d; int main () { char e[5]; for (; c < 5; c++) { while (a) { b = d; if (e[8000]) continue; break; } if (b) printf ("%d", a); } return 0; }