https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71595
--- Comment #1 from Zhendong Su <su at cs dot ucdavis.edu> --- Below is another test case that triggers the same ICE, but also at -O1 and -Os (in addition to -O2 and -O3). $ 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 20160624 (experimental) [trunk revision 237753] (GCC) $ $ gcc-trunk -O0 -c small.c $ gcc-6.1 -O1 -c small.c $ $ gcc-trunk -O1 -c small.c small.c: In function ‘fn1’: small.c:5:1: internal compiler error: in check_loop_closed_ssa_use, at tree-ssa-loop-manip.c:704 fn1 () ^~~ 0xd30c3c check_loop_closed_ssa_use ../../gcc-source-trunk/gcc/tree-ssa-loop-manip.c:703 0xd339f6 check_loop_closed_ssa_stmt ../../gcc-source-trunk/gcc/tree-ssa-loop-manip.c:719 0xd339f6 verify_loop_closed_ssa(bool) ../../gcc-source-trunk/gcc/tree-ssa-loop-manip.c:753 0xd17a6e tree_unroll_loops_completely(bool, bool) ../../gcc-source-trunk/gcc/tree-ssa-loop-ivcanon.c:1431 0xd17afa execute ../../gcc-source-trunk/gcc/tree-ssa-loop-ivcanon.c:1537 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, d, e, f, g, h; static int b[][6] = { {0}, {0}, {1, 1}, {1} }; void fn1 () { for (; f; f++) if (g) { for (e = 0; e < 5; e++) if (b[e + 2][1]) { h = b[2][e] ? 0 : a; d |= 4; } else return; } }