https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72746
Bug ID: 72746 Summary: gcc ICE at -O2 and above on valid code on x86_64-linux-gnu with “seg fault” Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: helloqirun at gmail dot com Target Milestone: --- The following valid code causes an ICE when compiled with the current gcc trunk at -O2 and -O3 on x86_64-linux-gnu in both 32- and 64-bit modes. It appears to be a 7 regression. $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/home/absozero/trunk/root-gcc/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --prefix=/home/absozero/trunk/root-gcc --enable-languages=c,c++ --disable-werror --enable-multilib Thread model: posix gcc version 7.0.0 20160728 (experimental) [trunk revision 238824] (GCC) $ gcc-trunk -O2 abc.c abc.c: In function ‘fn1’: abc.c:12:20: warning: division by zero [-Wdiv-by-zero] *d = a *= (c %= 0) > c + (f ? c : e); ^~ abc.c:17:9: warning: division by zero [-Wdiv-by-zero] f %= 0; ^~ gcc-trunk: internal compiler error: Segmentation fault (program cc1) Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. $ cat abc.c int a, b, f; long c; int *d; unsigned long e; void fn1 () { for (; f;) { for (;;) ; lblE83BAD08: *d = a *= (c %= 0) > c + (f ? c : e); } if ((a = 0) || (a = b ? 8 : a)) { f = 3; f %= 0; goto lblE83BAD08; } }