re PR debug/70935 (ICE: verify_ssa failed (error: definition in block 9 does not...
authorYuri Rumyantsev <ysrumyan@gmail.com>
Fri, 6 May 2016 12:07:25 +0000 (12:07 +0000)
committerIlya Enkovich <ienkovich@gcc.gnu.org>
Fri, 6 May 2016 12:07:25 +0000 (12:07 +0000)
gcc/

2016-05-06  Yuri Rumyantsev  <ysrumyan@gmail.com>

PR debug/70935
* tree-ssa-loop-unswitch.c (find_loop_guard): Reject guard edge with
loop latch destination.

gcc/testsuite/

2016-05-06  Yuri Rumyantsev  <ysrumyan@gmail.com>

PR debug/70935
* gcc.dg/torture/pr70935.c: New test.

From-SVN: r235962

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

index ed6c31b28241766797e891f7294f67f92ea865c5..8f3679a52b31f063b2d2fa5330194f7604554bd3 100644 (file)
@@ -1,3 +1,9 @@
+2016-05-06  Yuri Rumyantsev  <ysrumyan@gmail.com>
+
+       PR debug/70935
+       * tree-ssa-loop-unswitch.c (find_loop_guard): Reject guard edge with
+       loop latch destination.
+
 2016-05-06  Martin Liska  <mliska@suse.cz>
 
        * tree-ssa-uninit.c: Apply manual changes
index fc12a060feec2dcedea12e7a57d0fb5f6f594fb6..510e3feeeea3a630990d9e84f3a15e37a6002616 100644 (file)
@@ -1,3 +1,8 @@
+2016-05-06  Yuri Rumyantsev  <ysrumyan@gmail.com>
+
+       PR debug/70935
+       * gcc.dg/torture/pr70935.c: New test.
+
 2016-05-06  Oleg Endo  <olegendo@gcc.gnu.org>
 
        PR target/58219
diff --git a/gcc/testsuite/gcc.dg/torture/pr70935.c b/gcc/testsuite/gcc.dg/torture/pr70935.c
new file mode 100644 (file)
index 0000000..eb7f034
--- /dev/null
@@ -0,0 +1,39 @@
+/* { dg-do compile } */\r
+/* { dg-options "-O3 -g" } */\r
+\r
+int d0, sj, v0, rp, zi;\r
+\r
+void\r
+zn(void)\r
+{\r
+  if (v0 != 0)\r
+    {\r
+      int *js, *r3;\r
+      int pm, gc;\r
+\r
+      for (gc = 0; gc < 1; ++gc)\r
+        {\r
+          sj = 1;\r
+          while (sj != 0)\r
+            ;\r
+        }\r
+      r3 = &pm;\r
+      *js = (long)&gc;\r
+ka:\r
+      for (d0 = 0; d0 < 2; ++d0)\r
+        {\r
+          d0 = zi;\r
+          if (zi)\r
+            for (pm = 2; pm != 0; --pm)\r
+              ;\r
+        }\r
+      while (*r3 != 0)\r
+        {\r
+          while (pm)\r
+            ;\r
+          ++r3;\r
+        }\r
+    }\r
+  rp = 0;\r
+  goto ka;\r
+}
index 77acd66e997351a6fe4898e31960ef07aeedf1a8..bf9fafa63b2bb600bf7ba0e63db5583425b4f343 100644 (file)
@@ -536,6 +536,12 @@ find_loop_guard (struct loop *loop)
                 guard_edge->src->index, guard_edge->dest->index);
       return NULL;
     }
+  if (guard_edge->dest == loop->latch)
+    {
+      if (dump_file && (dump_flags & TDF_DETAILS))
+       fprintf (dump_file, "Guard edge destination is loop latch.\n");
+      return NULL;
+    }
 
   if (dump_file && (dump_flags & TDF_DETAILS))
     fprintf (dump_file,