https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66349
Bug ID: 66349 Summary: ICE on valid code at -O1, -O2 and -O3 on x86_64-linux-gnu in dfs_enumerate_from, at cfganal.c:1195 Product: gcc Version: 6.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 -O1, -O2 and -O3 on x86_64-linux-gnu in both 32-bit and 64-bit modes. It is a regression from 5.1.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/6.0.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 6.0.0 20150530 (experimental) [trunk revision 223885] (GCC) $ $ gcc-trunk -O0 -c small.c $ gcc-trunk -Os -c small.c $ gcc-5.1 -O1 -c small.c $ $ gcc-trunk -O1 -c small.c small.c: In function ‘fn1’: small.c:5:1: internal compiler error: in dfs_enumerate_from, at cfganal.c:1195 fn1 () ^ 0x6d8a09 dfs_enumerate_from(basic_block_def*, int, bool (*)(basic_block_def const*, void const*), basic_block_def**, int, void const*) ../../gcc-trunk/gcc/cfganal.c:1195 0xcd02e5 determine_bb_domination_status ../../gcc-trunk/gcc/tree-ssa-threadupdate.c:1768 0xcd02e5 thread_through_loop_header ../../gcc-trunk/gcc/tree-ssa-threadupdate.c:1953 0xcd253a thread_through_all_blocks(bool) ../../gcc-trunk/gcc/tree-ssa-threadupdate.c:2667 0xc1354b execute ../../gcc-trunk/gcc/tree-ssa-dom.c:1244 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. $ ------------------------------------- unsigned int a; int b, c, d, e, f; void fn1 () { for (; b; b++) { for (e = 0; e < 1; e++) ; int i = -1, j = 1; if (f) { for (; a < 1; a++) ; i++; j = 0; } for (; d; d++) { if (j) for (;; c++) ; if (i) continue; return; } } }