https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71132
Bug ID: 71132 Summary: gcc ICE at -O3 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 only -O3 on x86_64-linux-gnu in both 32-bit 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 20160515 (experimental) [trunk revision 236250] (GCC) $ gcc-trunk -O3 abc.c abc.c: In function ‘main’: abc.c:6:5: internal compiler error: Segmentation fault int main() { ^~~~ 0xbaa52f crash_signal ../../gcc/gcc/toplev.c:333 0xbe18e0 bb_seq_addr ../../gcc/gcc/gimple.h:1654 0xbe18e0 gsi_last_bb ../../gcc/gcc/gimple-iterator.h:163 0xbe18e0 last_stmt(basic_block_def*) ../../gcc/gcc/tree-cfg.c:2640 0xc38900 create_edge_for_control_dependence ../../gcc/gcc/tree-loop-distribution.c:282 0xc39bb6 create_rdg_cd_edges ../../gcc/gcc/tree-loop-distribution.c:327 0xc39bb6 build_rdg ../../gcc/gcc/tree-loop-distribution.c:458 0xc39f0b distribute_loop ../../gcc/gcc/tree-loop-distribution.c:1418 0xc3cdc7 execute ../../gcc/gcc/tree-loop-distribution.c:1791 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. $ cat abc.c typedef unsigned size_t; struct { unsigned char buf[sizeof(long)]; } a; size_t b; int main() { size_t c, i; unsigned char *d; for (; c < sizeof(long);) { d = a.buf; b = 0; for (; b < i; b++) *d++ = '\0'; for (; c < b; c++) *d++ = 'a'; c = 0; for (; i < sizeof(long); i++) ; } }