https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66949
Bug ID: 66949 Summary: ICE at -O2 and -O3 on x86_64-linux-gnu in tree_ssa_phiopt_worker, at tree-ssa-phiopt.c:335 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 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 20150719 (experimental) [trunk revision 225987] (GCC) $ $ gcc-trunk -Os small.c; ./a.out $ gcc-5.1 -O2 small.c; ./a.out $ $ gcc-trunk -O2 small.c small.c: In function ‘fn2’: small.c:10:1: internal compiler error: in tree_ssa_phiopt_worker, at tree-ssa-phiopt.c:335 fn2 () ^ 0xcf3dfd tree_ssa_phiopt_worker ../../gcc-trunk/gcc/tree-ssa-phiopt.c:335 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 = &a, c; unsigned short fn1 (unsigned short p1, unsigned int p2) { return p2 > 1 || p1 >> p2 ? p1 : p1 << p2; } void fn2 () { int *d = &a; for (a = 0; a < -1; a = 1) ; if (a < 0) c = 0; *b = fn1 (*d || c, *d); } int main () { fn2 (); return 0; }