https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70775
Bug ID: 70775 Summary: ICE on valid code at -O3 on x86_64-linux-gnu: Segmentation fault 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 both 32-bit and 64-bit modes. It is a regression from 5.3.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/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 20160423 (experimental) [trunk revision 235384] (GCC) $ $ gcc-trunk -O2 -c small.c $ gcc-5.3 -O3 -c small.c $ $ gcc-trunk -O3 -c small.c small.c: In function ‘fn2’: small.c:17:1: internal compiler error: Segmentation fault fn2 () ^~~ 0xb6718f crash_signal ../../gcc-source-trunk/gcc/toplev.c:333 0x74e89c vec_safe_length<loop*, va_gc> ../../gcc-source-trunk/gcc/vec.h:524 0x74e89c loop_depth ../../gcc-source-trunk/gcc/cfgloop.h:444 0x74e89c flow_loop_nested_p(loop const*, loop const*) ../../gcc-source-trunk/gcc/cfgloop.c:64 0xdb7837 vect_is_simple_reduction ../../gcc-source-trunk/gcc/tree-vect-loop.c:2627 0xdb9011 vect_force_simple_reduction ../../gcc-source-trunk/gcc/tree-vect-loop.c:3026 0xdb9011 vect_analyze_scalar_cycles_1 ../../gcc-source-trunk/gcc/tree-vect-loop.c:865 0xdbc807 vect_analyze_scalar_cycles ../../gcc-source-trunk/gcc/tree-vect-loop.c:939 0xdbc807 vect_analyze_loop_2 ../../gcc-source-trunk/gcc/tree-vect-loop.c:1845 0xdbc807 vect_analyze_loop(loop*) ../../gcc-source-trunk/gcc/tree-vect-loop.c:2264 0xdd7611 vectorize_loops() ../../gcc-source-trunk/gcc/tree-vectorizer.c:532 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. $ $ ------------------------------------------ struct S { int f1; int f2; } a; int b, c, d, e; short f; int fn1 (int p1, unsigned p2) { return p1 + p2; } void fn2 () { struct S g; int h; for (; c; c++) for (f = -3; f < 3; f = fn1 (f, 8)) { a.f1 = e; if (b) a = g; else for (; h; h++) d = b; } }