https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72488
Bug ID: 72488 Summary: wrong code (SIGFPE) at -Os and above on x86_64-linux-gnu (in the 64-bit mode) Product: gcc Version: 7.0 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: --- Created attachment 39012 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39012&action=edit test program The current gcc trunk miscompiles the attached code (small.c) on x86_64-linux-gnu at -Os and above in the 64-bit mode (but not in the 32-bit mode). This is a regression from 6.1.x. The code is extremely difficult to reduce, so the reported test is still rather large (21709 bytes). I am not certain, but fairly confident that it doesn't have undefined behaviors as it passes UBSan, CompCert's reference interpreter, the tis-interpreter, etc. $ 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 20160725 (experimental) [trunk revision 238706] (GCC) $ $ gcc-trunk -O1 small.c; ./a.out 507518-1357826554294967259-187769889781-5 $ gcc-6.1 -O2 small.c; ./a.out 507518-1357826554294967259-187769889781-5 $ $ gcc-trunk -Os small.c $ ./a.out Floating point exception (core dumped) $