http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59903
Bug ID: 59903 Summary: ICE on valid code at -O3 on x86_64-linux-gnu (affecting trunk and 4.8.x) Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu The following code causes an ICE when compiled with the current gcc trunk and 4.8.x at -O3 on x86_64-linux-gnu (in both 32-bit and 64-bit modes). It is a regression from 4.7.x. I had hoped to reduce it further, but this is the simplest I could get. $ 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/4.9.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 4.9.0 20140121 (experimental) [trunk revision 206876] (GCC) $ $ gcc-trunk -O2 small.c; a.out $ gcc-4.7.3 -O3 small.c; a.out $ $ gcc-trunk -O3 small.c small.c: In function ‘main’: small.c:45:1: internal compiler error: Segmentation fault main () ^ 0x9bf4df crash_signal ../../gcc-trunk/gcc/toplev.c:337 0xbaaee3 tree_check ../../gcc-trunk/gcc/tree.h:2708 0xbaaee3 vect_transform_loop(_loop_vec_info*) ../../gcc-trunk/gcc/tree-vect-loop.c:5872 0xbc859d vectorize_loops() ../../gcc-trunk/gcc/tree-vectorizer.c:476 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, g, h, i[3], l, m, n, o, p, q, r; struct S0 { int f0; int f1; int f2; int f3; } j; static int fn1 (int p1) { return p1 || ((p1 > 0) > (e << 1)); } static struct S0 fn2 (struct S0 p1) { char s; struct S0 t = {0,0,0,0}; int u = 2; for (;;) { if (i[0]) break; for (m = 0; m < 4; m++) for (p1.f0 = 0; p1.f0 < 3; p1.f0++) { j = t; t.f3 = i[p1.f0]; o = b || 1 >> b ? 0 : a < 0; q = 1 % d; if ((g < fn1 ((1 ^ (q & 1)) | n)) ^ u) j.f3 |= p % 2; s = j.f3 > 0 ? j.f3 : j.f3 << 1; r = l = s && p1.f1 * c; h = p1.f1; } } return p1; } int main () { for (;f;) { struct S0 v = {0,0,0,0}; fn2 (v); j.f3 = 0; } return 0; }