re PR tree-optimization/80876 (ICE in verify_loop_structure, at cfgloop.c:1644 (error...
authorRichard Biener <rguenther@suse.de>
Tue, 30 May 2017 07:49:00 +0000 (07:49 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 30 May 2017 07:49:00 +0000 (07:49 +0000)
2017-05-30  Richard Biener  <rguenther@suse.de>

PR middle-end/80876
* cfgexpand.c (expand_gimple_cond): Fixup preserving loops again.

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

From-SVN: r248633

gcc/ChangeLog
gcc/cfgexpand.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr80876.c [new file with mode: 0644]

index 2475e7afbc41a0e40a9e5f31ab6213b965f82e15..cf7edfd02528f7834e3dec7a5e36badaf5d16ecc 100644 (file)
@@ -1,3 +1,8 @@
+2017-05-30  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/80876
+       * cfgexpand.c (expand_gimple_cond): Fixup preserving loops again.
+
 2017-05-30  Martin Liska  <mliska@suse.cz>
 
        * dumpfile.c: Use newly added macro DUMP_FILE_INFO.
index 9965310353e6d9d93612d999fcf3d4c4bd1d530e..c5b4d70f4a32db3926d565ff378761e306ddd877 100644 (file)
@@ -2504,9 +2504,9 @@ expand_gimple_cond (basic_block bb, gcond *stmt)
   new_bb->count = false_edge->count;
   new_bb->frequency = EDGE_FREQUENCY (false_edge);
   add_bb_to_loop (new_bb, dest->loop_father);
-  if (bb->loop_father->latch == bb
-      && bb->loop_father->header == dest)
-    bb->loop_father->latch = new_bb;
+  if (dest->loop_father->latch == bb
+      && dest->loop_father->header == dest)
+    dest->loop_father->latch = new_bb;
   new_edge = make_edge (new_bb, dest, 0);
   new_edge->probability = REG_BR_PROB_BASE;
   new_edge->count = new_bb->count;
index 1b7ef9779db1d616a29ef9fb76595acb9a3d3614..682f95fe0746b781551078d1fc77a996850a094d 100644 (file)
@@ -1,3 +1,8 @@
+2017-05-30  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/80876
+       * gcc.dg/torture/pr80876.c: New testcase.
+
 2017-05-29  Nathan Sidwell  <nathan@acm.org>
 
        PR c++/80891 (#5)
diff --git a/gcc/testsuite/gcc.dg/torture/pr80876.c b/gcc/testsuite/gcc.dg/torture/pr80876.c
new file mode 100644 (file)
index 0000000..35f9f50
--- /dev/null
@@ -0,0 +1,42 @@
+/* { dg-do compile } */
+
+int sy;
+
+void
+fo (char o5)
+{
+  char yh = 0;
+
+  if (o5 == 0)
+    return;
+
+  while (o5 != 0)
+    if (0)
+      {
+       while (yh != 0)
+         {
+           o5 = 0;
+           while (o5 < 2)
+             {
+               sy &= yh;
+               if (sy != 0)
+                 {
+km:
+                   sy = yh;
+                 }
+             }
+           ++yh;
+         }
+      }
+    else
+      {
+       o5 = sy;
+       goto km;
+      }
+}
+
+void
+on (void)
+{
+  fo (sy);
+}