From b5066d8b10e81faa393606695d09efd9edcf5def Mon Sep 17 00:00:00 2001 From: Ira Rosen Date: Sun, 3 Jul 2011 10:14:55 +0000 Subject: [PATCH] re PR tree-optimization/49610 (Segfault with -ftree-vectorize (or -O3)) PR tree-optimization/49610 * tree-vect-loop.c (vect_is_slp_reduction): Check that DEF_STMT has a basic block. From-SVN: r175786 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/vect/pr49610.c | 12 ++++++++++++ gcc/tree-vect-loop.c | 2 ++ 4 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/vect/pr49610.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 63f2bd39eb8..28ff47174c1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-07-03 Ira Rosen + + PR tree-optimization/49610 + * tree-vect-loop.c (vect_is_slp_reduction): Check that DEF_STMT has + a basic block. + 2011-07-02 Eric Botcazou Olivier Hainque Nicolas Setton diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8460d89c917..abc81f7294a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-07-03 Ira Rosen + + PR tree-optimization/49610 + * gcc.dg/vect/pr49610.c: New test. + 2011-07-02 Eric Botcazou * gnat.dg/specs/debug1.ads: New test. diff --git a/gcc/testsuite/gcc.dg/vect/pr49610.c b/gcc/testsuite/gcc.dg/vect/pr49610.c new file mode 100644 index 00000000000..87ac5b50343 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr49610.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ + +extern int g_7; +void func_13(int p_17) { + int i; + for (i=0; i < 16; i = (signed char)(i+1)) { + g_7 &= p_17; + g_7 &= (p_17 > 1); + } +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 0352607732b..63b346979af 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -1823,6 +1823,7 @@ vect_is_slp_reduction (loop_vec_info loop_info, gimple phi, gimple first_stmt) ("vect_internal_def"), or it's an induction (defined by a loop-header phi-node). */ if (def_stmt + && gimple_bb (def_stmt) && flow_bb_inside_loop_p (loop, gimple_bb (def_stmt)) && (is_gimple_assign (def_stmt) || is_gimple_call (def_stmt) @@ -1852,6 +1853,7 @@ vect_is_slp_reduction (loop_vec_info loop_info, gimple phi, gimple first_stmt) ("vect_internal_def"), or it's an induction (defined by a loop-header phi-node). */ if (def_stmt + && gimple_bb (def_stmt) && flow_bb_inside_loop_p (loop, gimple_bb (def_stmt)) && (is_gimple_assign (def_stmt) || is_gimple_call (def_stmt) -- 2.30.2