https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67109
Bug ID: 67109 Summary: ICE at -O3 on x86_64-linux-gnu in vect_analyze_slp_instance, at tree-vect-slp.c:1793 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 -O3 on x86_64-linux-gnu in the 64-bit mode (but not in the 32-bit mode). It is a regression from 5.1.x (I didn't check 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 20150803 (experimental) [trunk revision 226526] (GCC) $ $ gcc-trunk -m64 -O2 -c small.c small.c: In function ‘fn1’: small.c:12:9: warning: iteration 1u invokes undefined behavior [-Waggressive-loop-optimizations] b[a] ^= 1; ^ small.c:10:7: note: containing loop for (; c < 5; c++) ^ $ gcc-trunk -m32 -O3 -c small.c small.c: In function ‘fn1’: small.c:12:9: warning: iteration 1u invokes undefined behavior [-Waggressive-loop-optimizations] b[a] ^= 1; ^ small.c:10:7: note: containing loop for (; c < 5; c++) ^ $ $ gcc-5.1 -m64 -O3 -c small.c small.c: In function ‘fn1’: small.c:12:9: warning: iteration 1u invokes undefined behavior [-Waggressive-loop-optimizations] b[a] ^= 1; ^ small.c:10:7: note: containing loop for (; c < 5; c++) ^ $ $ gcc-trunk -m64 -O3 -c small.c small.c: In function ‘fn1’: small.c:12:9: warning: iteration 1u invokes undefined behavior [-Waggressive-loop-optimizations] b[a] ^= 1; ^ small.c:10:7: note: containing loop for (; c < 5; c++) ^ small.c:5:1: internal compiler error: in vect_analyze_slp_instance, at tree-vect-slp.c:1793 fn1 () ^ 0xcf91c5 vect_analyze_slp_instance ../../gcc-trunk/gcc/tree-vect-slp.c:1793 0xcf9ab7 vect_analyze_slp(_loop_vec_info*, _bb_vec_info*, unsigned int) ../../gcc-trunk/gcc/tree-vect-slp.c:1879 0xcf9eee vect_slp_analyze_bb_1 ../../gcc-trunk/gcc/tree-vect-slp.c:2426 0xcf9eee vect_slp_analyze_bb(basic_block_def*) ../../gcc-trunk/gcc/tree-vect-slp.c:2552 0xcfce22 execute ../../gcc-trunk/gcc/tree-vectorizer.c:702 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[1], c, d; void fn1 () { for (; d;) { a = c = 0; for (; c < 5; c++) { b[a] ^= 1; a--; } } }