re PR tree-optimization/71398 (ICE at -O3 in 32-bit and 64-bit mode on x86_64-linux...
authorRichard Biener <rguenther@suse.de>
Mon, 6 Jun 2016 06:55:19 +0000 (06:55 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 6 Jun 2016 06:55:19 +0000 (06:55 +0000)
2016-06-06  Richard Biener  <rguenther@suse.de>

PR tree-optimization/71398
* tree-ssa-loop-ivcanon.c (unloop_loops): First unloop, then
remove edges.

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

From-SVN: r237117

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr71398.c [new file with mode: 0644]
gcc/tree-ssa-loop-ivcanon.c

index 0b3e3aa81dd161388b6c5fa6a21e5a3c25dccf12..8e4b77687f90e8d078beeeafd4e5bee4dc285a30 100644 (file)
@@ -1,3 +1,9 @@
+2016-06-06  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/71398
+       * tree-ssa-loop-ivcanon.c (unloop_loops): First unloop, then
+       remove edges.
+
 2016-06-05  James Bowman  <james.bowman@ftdichip.com>
 
        * config/ft32/ft32.c (ft32_setup_incoming_varargs,
index c09354d320316140cb29ec47715cc57a16802dfb..4dc8a52a75af9eaa0f9a35e34277db023635bc00 100644 (file)
@@ -1,3 +1,8 @@
+2016-06-06  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/71398
+       * gcc.dg/torture/pr71398.c: New testcase.
+
 2016-06-06  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/71389
diff --git a/gcc/testsuite/gcc.dg/torture/pr71398.c b/gcc/testsuite/gcc.dg/torture/pr71398.c
new file mode 100644 (file)
index 0000000..affb561
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+unsigned a, b, c[1];
+void __assert_fail() __attribute__((__noreturn__));
+void fn1()
+{
+  int d;
+  unsigned e;
+  for (;;)
+    {
+      d = 0;
+      for (; d <= 6; d++)
+       c[d] || a ? 0 : __assert_fail();
+      for (; e <= 5; e++)
+       a = b;
+    }
+}
index 248c125949679bf573c97db9bc93d01d9d7b1901..5a7c378a9755db49bcd7cc6b9d25ed4ba93027d4 100644 (file)
@@ -615,16 +615,6 @@ static void
 unloop_loops (bitmap loop_closed_ssa_invalidated,
              bool *irred_invalidated)
 {
-  /* First remove edges in peeled copies.  */
-  unsigned i;
-  edge e;
-  FOR_EACH_VEC_ELT (edges_to_remove, i, e)
-    {
-      bool ok = remove_path (e);
-      gcc_assert (ok);
-    }
-  edges_to_remove.release ();
-
   while (loops_to_unloop.length ())
     {
       struct loop *loop = loops_to_unloop.pop ();
@@ -660,6 +650,16 @@ unloop_loops (bitmap loop_closed_ssa_invalidated,
     }
   loops_to_unloop.release ();
   loops_to_unloop_nunroll.release ();
+
+  /* Remove edges in peeled copies.  */
+  unsigned i;
+  edge e;
+  FOR_EACH_VEC_ELT (edges_to_remove, i, e)
+    {
+      bool ok = remove_path (e);
+      gcc_assert (ok);
+    }
+  edges_to_remove.release ();
 }
 
 /* Tries to unroll LOOP completely, i.e. NITER times.