http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50039
Bug #: 50039 Summary: Segfault in vect_operation_fits_smaller_type() Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: arthur.j.odw...@gmail.com Created attachment 24972 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24972 Output of "ajo-gcc -std=c99 -O2 -ftree-vectorize -fno-tree-fre test.c -v" This failure reproduces for me with svn revision 177610 (2011-08-09), going back at least as far as 177466 (2011-08-05). I'm on Ubuntu 10.10, x86-64. Incidentally, it might be a good idea to put some "redundant" null-checks in the tree vectorizer. I see a ton of segfaults being reported against it as far back as 4.2. If those were ICEs instead, it might be easier to distinguish duplicates; and IMHO ICEs are preferable to segfaults anyway. cat >test.c <<EOF extern unsigned char g_5; extern int g_31, g_76; int main(void) { for (int j=0; j < 2; ++j) { g_31 = -3; for (int i=0; i < 2; ++i) g_76 = (g_31 ? g_31+1 : 0) ^ g_5; } } EOF gcc -std=c99 -O2 -ftree-vectorize -fno-tree-fre test.c test.c: In function ‘main’: test.c:3:5: internal compiler error: Segmentation fault (gdb) run Program received signal SIGSEGV, Segmentation fault. vect_operation_fits_smaller_type (stmts=0x7fffffffde88, type_in=0x7fffffffde78, type_out=0x7fffffffde80) at ../../gcc/tree-vect-patterns.c:982 982 if (STMT_VINFO_RELATED_STMT (vinfo_for_stmt (def_stmt))) (gdb) backtrace #0 vect_operation_fits_smaller_type (stmts=0x7fffffffde88, type_in=0x7fffffffde78, type_out=0x7fffffffde80) at ../../gcc/tree-vect-patterns.c:982 #1 vect_recog_over_widening_pattern (stmts=0x7fffffffde88, type_in=0x7fffffffde78, type_out=0x7fffffffde80) at ../../gcc/tree-vect-patterns.c:1088 #2 0x0000000000d462e9 in vect_pattern_recog_1 (loop_vinfo=Unhandled dwarf expression opcode 0xf3) at ../../gcc/tree-vect-patterns.c:1284 [...] This test case is reduced from the output of Csmith 2.1.0 (git hash 210eda7, https://github.com/Quuxplusone/csmith/), using the following command line: csmith --paranoid --longlong --no-pointers --arrays --no-jumps --consts --no-volatiles --no-checksum --no-divs --no-muls --no-bitfields --no-packed-struct -s 1902267639