]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/62073 (Segmentation fault with tree vectorize)
authorFelix Yang <fei.yang0953@gmail.com>
Mon, 11 Aug 2014 11:24:35 +0000 (11:24 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 11 Aug 2014 11:24:35 +0000 (11:24 +0000)
2014-08-11  Felix Yang  <fei.yang0953@gmail.com>

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: r213812

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr62073.c [new file with mode: 0644]
gcc/tree-vect-loop.c

index 87f38b0d928884e33b960af117ec536dc1a775f9..ccd932a5a6e055a75413fdcc3f103bceab08cc09 100644 (file)
@@ -1,3 +1,9 @@
+2014-08-11  Felix Yang  <fei.yang0953@gmail.com>
+
+       PR tree-optimization/62073
+       * tree-vect-loop.c (vect_is_simple_reduction_1): Check that DEF1 has
+       a basic block.
+       
 2014-08-11  Alexander Ivchenko  <alexander.ivchenko@intel.com>
            Maxim Kuznetsov  <maxim.kuznetsov@intel.com>
            Anna Tikhonova  <anna.tikhonova@intel.com>
index 10656422c69cb2b7ad823cf83069fd89744b8ec2..10b9eb28fd34b56f345ff3b5321fc9912fbe7c1c 100644 (file)
@@ -1,3 +1,8 @@
+2014-08-11  Felix Yang  <fei.yang0953@gmail.com>
+
+       PR tree-optimization/62073
+       * gcc.dg/vect/pr62073.c: New test.
+       
 2014-08-11  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/62070
diff --git a/gcc/testsuite/gcc.dg/vect/pr62073.c b/gcc/testsuite/gcc.dg/vect/pr62073.c
new file mode 100644 (file)
index 0000000..15f2ad6
--- /dev/null
@@ -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" } } */
index 7e013f3b549a07bd44789bd4d3e3701eec7c51dc..fd1166f5fd74ff2b95e43133994d3ba2ff465249 100644 (file)
@@ -2321,7 +2321,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))