Bug 49610 - Segfault with -ftree-vectorize (or -O3)
Summary: Segfault with -ftree-vectorize (or -O3)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-01 17:24 UTC by Arthur O'Dwyer
Modified: 2011-07-04 15:52 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-07-01 19:17:53


Attachments
Output of "ajo-gcc -std=c99 -O -ftree-vectorize test.c -v" (737 bytes, text/plain)
2011-07-01 17:24 UTC, Arthur O'Dwyer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Arthur O'Dwyer 2011-07-01 17:24:11 UTC
Created attachment 24656 [details]
Output of "ajo-gcc -std=c99 -O -ftree-vectorize test.c -v"

This failure reproduces for me with svn revision 175547
(2011-06-27). I'm on Ubuntu 10.10, x86-64.

cat >test.c <<EOF
extern int g_7;
void func_13(int p_17) {
    for (int i=0; i < 16; i = (signed char)(i+1)) { 
        g_7 &= p_17;
        g_7 &= (p_17 > 1);
    }
}
EOF
gcc -std=c99 -O -ftree-vectorize test.c 

test.c: In function ‘func_13’:
test.c:2:6: internal compiler error: Segmentation fault

Program received signal SIGSEGV, Segmentation fault.
flow_bb_inside_loop_p (loop=0x7ffff7ec1f68, bb=0x0) at ../../gcc/cfgloop.c:776
776	  source_loop = bb->loop_father;
(gdb) backtrace
#0  flow_bb_inside_loop_p (loop=0x7ffff7ec1f68, bb=0x0)
    at ../../gcc/cfgloop.c:776
#1  0x00000000009cb3bb in vect_is_slp_reduction (loop_info=0x14c56e0, phi=XXX)
    at ../../gcc/tree-vect-loop.c:1807
#2  vect_is_simple_reduction_1 (loop_info=0x14c56e0, phi=XXX)
    at ../../gcc/tree-vect-loop.c:2269
[...]


This test case is reduced from the output of Csmith 2.1.0 (git hash 01aa8b04,
https://github.com/Quuxplusone/csmith/), using the following command line:
csmith --no-paranoid --longlong --pointers --arrays --no-jumps --consts --no-volatiles --checksum --no-divs --muls --bitfields --packed-struct -s 1439171589
Comment 1 Dominique d'Humieres 2011-07-01 19:17:53 UTC
Revision 174379 is OK, r174433 is not.
Comment 2 Dominique d'Humieres 2011-07-01 19:44:36 UTC
It could be due to revision 174425:

Author:	irar
Date:	Mon May 30 07:15:31 2011 UTC (4 weeks, 4 days ago)
Changed paths:	5
Log Message:	
        PR tree-optimization/49199
        * tree-vect-loop.c (vect_is_slp_reduction): Check that the 
        non-reduction operands are either defined in the loop or
        by induction.
Comment 3 irar 2011-07-03 10:14:59 UTC
Author: irar
Date: Sun Jul  3 10:14:55 2011
New Revision: 175786

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175786
Log:

        PR tree-optimization/49610
        * tree-vect-loop.c (vect_is_slp_reduction): Check that DEF_STMT has
        a basic block.


Added:
    trunk/gcc/testsuite/gcc.dg/vect/pr49610.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-loop.c
Comment 4 Ira Rosen 2011-07-03 10:17:08 UTC
Fixed.