From: Felix Yang Date: Wed, 13 Aug 2014 10:11:49 +0000 (+0000) Subject: re PR c/62073 (Segmentation fault with tree vectorize) X-Git-Tag: releases/gcc-4.8.4~290 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=066286bb65e61bda798e35f133d80d1b178bb13f;p=thirdparty%2Fgcc.git re PR c/62073 (Segmentation fault with tree vectorize) 2014-08-13 Felix Yang PR tree-optimization/62073 * tree-vect-loop.c (vect_is_simple_reduction_1): Check that DEF1 has a basic block. * gcc.dg/vect/pr62073.c: New test. From-SVN: r213904 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e7771545c208..8bcd63fc19ed 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-08-13 Felix Yang + + PR tree-optimization/62073 + * tree-vect-loop.c (vect_is_simple_reduction_1): Check that DEF1 has + a basic block. + 2014-08-13 Thomas Preud'homme Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bcb2b66eff97..0a2ddbed3fa7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-08-13 Felix Yang + + PR tree-optimization/62073 + * gcc.dg/vect/pr62073.c: New test. + 2014-08-13 Thomas Preud'homme Backport from mainline diff --git a/gcc/testsuite/gcc.dg/vect/pr62073.c b/gcc/testsuite/gcc.dg/vect/pr62073.c new file mode 100644 index 000000000000..15f2ad66b0c9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr62073.c @@ -0,0 +1,40 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O1" } */ + +struct S0 +{ + int f7; +}; +struct S0 g_50; +int g_70; +int g_76; + +int foo (long long p_56, int * p_57) +{ + int *l_77; + int l_101; + + for (; g_70;) + { + int **l_78 = &l_77; + if (g_50.f7) + continue; + *l_78 = 0; + } + for (g_76 = 1; g_76 >= 0; g_76--) + { + int *l_90; + for (l_101 = 4; l_101 >= 0; l_101--) + if (l_101) + *l_90 = 0; + else + { + int **l_113 = &l_77; + *l_113 = p_57; + } + } + + return *l_77; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 7607d956d9ef..dd10d87ffcb7 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -2205,7 +2205,8 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi, } def1 = SSA_NAME_DEF_STMT (op1); - if (flow_bb_inside_loop_p (loop, gimple_bb (def_stmt)) + if (gimple_bb (def1) + && flow_bb_inside_loop_p (loop, gimple_bb (def_stmt)) && loop->inner && flow_bb_inside_loop_p (loop->inner, gimple_bb (def1)) && is_gimple_assign (def1))