re PR middle-end/65517 (ICE: in get_loop_body, at cfgloop.c:856)
authorRichard Biener <rguenther@suse.de>
Tue, 24 Mar 2015 09:31:48 +0000 (09:31 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 24 Mar 2015 09:31:48 +0000 (09:31 +0000)
2015-03-24  Richard Biener  <rguenther@suse.de>

PR middle-end/65517
* tree-cfg.c (remove_edge_and_dominated_blocks): Mark loops
for fixup if necessary.

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

From-SVN: r221619

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr65517.c [new file with mode: 0644]
gcc/tree-cfg.c

index fd75d24494e98a7e6ac5e7281d0e579824b432bc..94643feb28666533d7d57c2dfd171a570ac66ff4 100644 (file)
@@ -1,3 +1,9 @@
+2015-03-24  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/65517
+       * tree-cfg.c (remove_edge_and_dominated_blocks): Mark loops
+       for fixup if necessary.
+
 2015-03-23  Sandra Loosemore  <sandra@codesourcery.com>
 
        * doc/extend.texi (Function Attributes): Add @cindex entries
index 2deffd0c0296e71e0937394d2d9eb5516cb2bfc0..6e8f5b1d241b4e6acdfdc8edd7dedfbac045a782 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-24  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/65517
+       * gcc.dg/torture/pr65517.c: New testcase.
+
 2015-03-24  Tobias Burnus  <burnus@net-b.de>
 
        * gfortran.dg/coindexed_1.f90: Moved from
diff --git a/gcc/testsuite/gcc.dg/torture/pr65517.c b/gcc/testsuite/gcc.dg/torture/pr65517.c
new file mode 100644 (file)
index 0000000..a63a03a
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */\r
+\r
+typedef void (*argmatch_exit_fn)();\r
+int a;\r
+void __argmatch_die () { __builtin_exit (0); }\r
+\r
+int\r
+main ()\r
+{\r
+  while (1)\r
+    {\r
+      argmatch_exit_fn b = __argmatch_die;\r
+      if (a)\r
+       b ();\r
+    }\r
+  return 0;\r
+}\r
index 0f5e428124c71bd7c91e8e36ece4d87bf8dd455e..98d6ba448faf629b20f83c24ace7b072a02b0e4f 100644 (file)
@@ -7824,6 +7824,13 @@ remove_edge_and_dominated_blocks (edge e)
   basic_block bb, dbb;
   bitmap_iterator bi;
 
+  /* If we are removing a path inside a non-root loop that may change
+     loop ownership of blocks or remove loops.  Mark loops for fixup.  */
+  if (current_loops
+      && loop_outer (e->src->loop_father) != NULL
+      && e->src->loop_father == e->dest->loop_father)
+    loops_state_set (LOOPS_NEED_FIXUP);
+
   if (!dom_info_available_p (CDI_DOMINATORS))
     {
       remove_edge (e);