re PR tree-optimization/49610 (Segfault with -ftree-vectorize (or -O3))
authorIra Rosen <ira.rosen@linaro.org>
Sun, 3 Jul 2011 10:14:55 +0000 (10:14 +0000)
committerIra Rosen <irar@gcc.gnu.org>
Sun, 3 Jul 2011 10:14:55 +0000 (10:14 +0000)
        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
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr49610.c [new file with mode: 0644]
gcc/tree-vect-loop.c

index 63f2bd39eb8aeef4032eda089f168f79d67c246a..28ff47174c10c1105bd96f756ac09b0bc6b4b366 100644 (file)
@@ -1,3 +1,9 @@
+2011-07-03  Ira Rosen  <ira.rosen@linaro.org>
+
+       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  <ebotcazou@adacore.com>
            Olivier Hainque  <hainque@adacore.com>
            Nicolas Setton  <setton@adacore.com>
index 8460d89c91719a9ed86d6dcaf6038b63ac22ac28..abc81f7294ae1080d215a703d60e13cda27bcd97 100644 (file)
@@ -1,3 +1,8 @@
+2011-07-03  Ira Rosen  <ira.rosen@linaro.org>
+
+       PR tree-optimization/49610
+       * gcc.dg/vect/pr49610.c: New test.
+
 2011-07-02  Eric Botcazou  <ebotcazou@adacore.com>
 
        * 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 (file)
index 0000000..87ac5b5
--- /dev/null
@@ -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" } } */
index 0352607732ba0a48fdad9fb993aca0294bed012b..63b346979af9c3cd44c175403b26d1e377a6f5ae 100644 (file)
@@ -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)