https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68013
Bug ID: 68013 Summary: ICE on valid code at -O2 on x86_64-linux-gnu in duplicate_thread_path, at tree-ssa-threadupdate.c:2469 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 -O2 on x86_64-linux-gnu in both 32-bit and 64-bit modes. It is a regression from 5.2.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/6.0.0/lto-wrapper Target: x86_64-pc-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 20151018 (experimental) [trunk revision 228953] (GCC) $ $ gcc-trunk -Os -c small.c $ gcc-5.2 -O2 -c small.c $ $ gcc-trunk -O2 -c small.c small.c: In function ‘fn1’: small.c:4:1: internal compiler error: in duplicate_thread_path, at tree-ssa-threadupdate.c:2469 fn1 () ^ 0xcd3440 duplicate_thread_path ../../gcc-trunk/gcc/tree-ssa-threadupdate.c:2468 0xcd3440 thread_through_all_blocks(bool) ../../gcc-trunk/gcc/tree-ssa-threadupdate.c:2669 0xc0a203 execute ../../gcc-trunk/gcc/tree-ssa-dom.c:622 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, c, d, e, f; void fn1 () { for (; e;) { e = f; for (; b;) { b = a; f = a || d ? 0 : c; } d = 0; } }