]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/69173 (ICE (segfault) in vinfo_for_stmt)
authorRichard Biener <rguenther@suse.de>
Mon, 11 Jan 2016 16:02:23 +0000 (16:02 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 11 Jan 2016 16:02:23 +0000 (16:02 +0000)
2016-01-11  Richard Biener  <rguenther@suse.de>

PR tree-optimization/69173
* tree-vect-loop.c (vect_fixup_scalar_cycles_with_patterns): Only
fixup the cycle if all stmts are in a pattern.

* gcc.dg/torture/pr69173.c: New testcase.

From-SVN: r232230

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

index 62aaea2652520a30f4733608e414361065644464..a256b34d9785728f2695e05e530f137c87e26134 100644 (file)
@@ -1,3 +1,9 @@
+2016-01-11  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/69173
+       * tree-vect-loop.c (vect_fixup_scalar_cycles_with_patterns): Only
+       fixup the cycle if all stmts are in a pattern.
+
 2016-01-11  Uros Bizjak  <ubizjak@gmail.com>
 
        PR middle-end/68999
index 6366b495bceb6f1005aea2f57dc8fdc79b037e9c..414c17411fc8e934e73f606d5db9521b3a2f50a7 100644 (file)
@@ -1,3 +1,8 @@
+2016-01-11  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/69173
+       * gcc.dg/torture/pr69173.c: New testcase.
+
 2016-01-11  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        PR rtl-optimization/68796
diff --git a/gcc/testsuite/gcc.dg/torture/pr69173.c b/gcc/testsuite/gcc.dg/torture/pr69173.c
new file mode 100644 (file)
index 0000000..f2936ce
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+
+unsigned a;
+unsigned *b;
+void fn1() {
+    char c;
+    while (b < (unsigned *)fn1)
+      {
+       a += b[2] + c;
+       b++;
+      }
+}
index a82cf26f71b28aab969e6d9bd22bacf92a8a21e7..a797f7056de22ffc842ea687bb4c77956ce0b62e 100644 (file)
@@ -985,9 +985,21 @@ vect_fixup_scalar_cycles_with_patterns (loop_vec_info loop_vinfo)
   FOR_EACH_VEC_ELT (LOOP_VINFO_REDUCTION_CHAINS (loop_vinfo), i, first)
     if (STMT_VINFO_IN_PATTERN_P (vinfo_for_stmt (first)))
       {
-       vect_fixup_reduc_chain (first);
-       LOOP_VINFO_REDUCTION_CHAINS (loop_vinfo)[i]
-         = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (first));
+       gimple *next = GROUP_NEXT_ELEMENT (vinfo_for_stmt (first));
+       while (next)
+         {
+           if (! STMT_VINFO_IN_PATTERN_P (vinfo_for_stmt (next)))
+             break;
+           next = GROUP_NEXT_ELEMENT (vinfo_for_stmt (next));
+         }
+       /* If not all stmt in the chain are patterns try to handle
+          the chain without patterns.  */
+       if (! next)
+         {
+           vect_fixup_reduc_chain (first);
+           LOOP_VINFO_REDUCTION_CHAINS (loop_vinfo)[i]
+             = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (first));
+         }
       }
 }