http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59322
Bug ID: 59322 Summary: ICE with segfault on valid code at -O1, -O2, and -O3 on x86_64-linux-gnu Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu The following code causes an ICE when compiled with the current gcc trunk at -O1, -O2 and -O3 on x86_64-linux-gnu in both 32-bit and 64-bit modes. It is a regression from 4.8.x. $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk --enable-languages=c,c++ --disable-werror --enable-multilib Thread model: posix gcc version 4.9.0 20131127 (experimental) [trunk revision 205463] (GCC) $ $ gcc-trunk -O0 -c small.c $ gcc-trunk -Os -c small.c $ gcc-4.8.2 -O1 -c small.c $ $ gcc-trunk -O1 -c small.c small.c: In function ‘foo’: small.c:5:1: internal compiler error: Segmentation fault foo () ^ 0x9ab60f crash_signal ../../gcc-trunk/gcc/toplev.c:336 0xb4c595 thread_through_all_blocks(bool) ../../gcc-trunk/gcc/tree-ssa-threadupdate.c:1651 0xa93a4a tree_ssa_dominator_optimize ../../gcc-trunk/gcc/tree-ssa-dom.c:886 0xa93a4a execute ../../gcc-trunk/gcc/tree-ssa-dom.c:984 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. $ ---------------------------- int a, b, d; short c; int foo () { for (b = 0; b; b = a) for (c = 18; c < 10; c++) { d = c; if (d) return 0; } return 0; }