https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71366
Bug ID: 71366 Summary: ICE on valid code at -O3 on x86_64-linux-gnu: Segmentation fault Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- The following code causes an ICE when compiled with the current gcc trunk at -O3 on x86_64-linux-gnu in both 32-bit and 64-bit modes. It is a regression from 6.1.x. $ 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 20160531 (experimental) [trunk revision 236912] (GCC) $ $ gcc-trunk -O2 -c small.c $ gcc-6.1 -O3 -c small.c $ $ gcc-trunk -O3 -c small.c small.c: In function ‘fn1’: small.c:4:1: internal compiler error: Segmentation fault fn1 () ^~~ 0xbbd02f crash_signal ../../gcc-source-trunk/gcc/toplev.c:333 0xd08d70 vec_safe_length<loop*, va_gc> ../../gcc-source-trunk/gcc/vec.h:529 0xd08d70 loop_outer ../../gcc-source-trunk/gcc/cfgloop.h:456 0xd08d70 tree_unroll_loops_completely_1 ../../gcc-source-trunk/gcc/tree-ssa-loop-ivcanon.c:1347 0xd08ce0 tree_unroll_loops_completely_1 ../../gcc-source-trunk/gcc/tree-ssa-loop-ivcanon.c:1314 0xd08ce0 tree_unroll_loops_completely_1 ../../gcc-source-trunk/gcc/tree-ssa-loop-ivcanon.c:1314 0xd09013 tree_unroll_loops_completely(bool, bool) ../../gcc-source-trunk/gcc/tree-ssa-loop-ivcanon.c:1384 0xd09583 execute ../../gcc-source-trunk/gcc/tree-ssa-loop-ivcanon.c:1593 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[1][2], b, c; int fn1 () { int d; for (; c;) for (d = 2; d >= 0;) { int e[4], f = e[3]; if (f) return b; d--; for (;;) { c = a[0][d]; break; } } return 0; }