The following fixes lower_eh_dispatch destroying dominator info
that was still live from previous passes.  This clears it from the
obvious place (when we think we might have created unreachable blocks).

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

2017-10-26  Richard Biener  <rguent...@suse.de>

        PR middle-end/81659
        * tree-eh.c (pass_lower_eh_dispatch::execute): Free dominator
        info when we redirected EH.

        * g++.dg/torture/pr81659.C: New testcase.

Index: gcc/tree-eh.c
===================================================================
--- gcc/tree-eh.c       (revision 254099)
+++ gcc/tree-eh.c       (working copy)
@@ -3779,7 +3779,10 @@ pass_lower_eh_dispatch::execute (functio
     }
 
   if (redirected)
-    delete_unreachable_blocks ();
+    {
+      free_dominance_info (CDI_DOMINATORS);
+      delete_unreachable_blocks ();
+    }
   return flags;
 }
 
Index: gcc/testsuite/g++.dg/torture/pr81659.C
===================================================================
--- gcc/testsuite/g++.dg/torture/pr81659.C      (nonexistent)
+++ gcc/testsuite/g++.dg/torture/pr81659.C      (working copy)
@@ -0,0 +1,19 @@
+// { dg-do compile }
+
+void
+a (int b)
+{
+  if (b)
+    throw;
+  try
+    {
+      a (3);
+    }
+  catch (int)
+    {
+    }
+  catch (int)
+    {
+    }
+}
+

Reply via email to