re PR tree-optimization/17724 (wrong dominator (eh/fold all builtins) related)
authorJakub Jelinek <jakub@redhat.com>
Wed, 13 Oct 2004 11:27:01 +0000 (13:27 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 13 Oct 2004 11:27:01 +0000 (13:27 +0200)
PR tree-optimization/17724
* tree-cfg.c (tree_purge_dead_eh_edges): Free dominance info.

* g++.dg/opt/pr17724-1.C: New test.
* g++.dg/opt/pr17724-2.C: New test.
* g++.dg/opt/pr17724-3.C: New test.
* g++.dg/opt/pr17724-4.C: New test.
* g++.dg/opt/pr17724-5.C: New test.
* g++.dg/opt/pr17724-6.C: New test.

Co-Authored-By: Zdenek Dvorak <dvorakz@suse.cz>
From-SVN: r88979

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/pr17724-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/opt/pr17724-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/opt/pr17724-3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/opt/pr17724-4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/opt/pr17724-5.C [new file with mode: 0644]
gcc/testsuite/g++.dg/opt/pr17724-6.C [new file with mode: 0644]
gcc/tree-cfg.c

index 815a79d700094865804d099f8fa1bec921b71d01..d868de44cbcb0f49768b65df09ae7334db383518 100644 (file)
@@ -1,3 +1,9 @@
+2004-10-13  Jakub Jelinek  <jakub@redhat.com>
+           Zdenek Dvorak  <dvorakz@suse.cz>
+
+       PR tree-optimization/17724
+       * tree-cfg.c (tree_purge_dead_eh_edges): Free dominance info.
+
 2004-10-13  Dorit Naishlos  <dorit@il.ibm.com>
 
        * rs6000.c (altivec_builtin_mask_for_load): Made static GTY(()).
index 766dcecec232b89cdc496fb4a51887106768815a..d08d00545e5bb335d6acf75d92fc957d1d10765a 100644 (file)
@@ -1,3 +1,13 @@
+2004-10-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/17724
+       * g++.dg/opt/pr17724-1.C: New test.
+       * g++.dg/opt/pr17724-2.C: New test.
+       * g++.dg/opt/pr17724-3.C: New test.
+       * g++.dg/opt/pr17724-4.C: New test.
+       * g++.dg/opt/pr17724-5.C: New test.
+       * g++.dg/opt/pr17724-6.C: New test.
+
 2004-10-12  Joseph S. Myers  <jsm@polyomino.org.uk>
 
        PR c/17301
diff --git a/gcc/testsuite/g++.dg/opt/pr17724-1.C b/gcc/testsuite/g++.dg/opt/pr17724-1.C
new file mode 100644 (file)
index 0000000..79de663
--- /dev/null
@@ -0,0 +1,23 @@
+// PR tree-optimization/17724
+// { dg-do compile }
+// { dg-options "-O2" }
+
+namespace N { char *strcpy (char *, const char *); }
+extern "C" char *strcpy (char *, const char *) throw ();
+inline char *N::strcpy (char *s, const char *t) { return ::strcpy (s, t); }
+
+struct S { ~S (); };
+int foo ();
+
+int
+main ()
+{
+  S s;
+  int a;
+  char b[64];
+  N::strcpy (b, "ABCDEFGHIJKLM");
+  while ((a = foo ()) != -1)
+    if (a)
+      return -1;
+  return 0;
+}
diff --git a/gcc/testsuite/g++.dg/opt/pr17724-2.C b/gcc/testsuite/g++.dg/opt/pr17724-2.C
new file mode 100644 (file)
index 0000000..c9c7f2a
--- /dev/null
@@ -0,0 +1,23 @@
+// PR tree-optimization/17724
+// { dg-do compile }
+// { dg-options "-O2" }
+
+namespace N { char *strcpy (char *, const char *); }
+extern "C" char *strcpy (char *, const char *);
+inline char *N::strcpy (char *s, const char *t) { return ::strcpy (s, t); }
+
+struct S { ~S (); };
+int foo ();
+
+int
+main ()
+{
+  S s;
+  int a;
+  char b[64];
+  N::strcpy (b, "ABCDEFGHIJKLM");
+  while ((a = foo ()) != -1)
+    if (a)
+      return -1;
+  return 0;
+}
diff --git a/gcc/testsuite/g++.dg/opt/pr17724-3.C b/gcc/testsuite/g++.dg/opt/pr17724-3.C
new file mode 100644 (file)
index 0000000..212ab47
--- /dev/null
@@ -0,0 +1,24 @@
+// PR tree-optimization/17724
+// { dg-do compile }
+// { dg-options "-O2" }
+
+extern "C" char *strcpy (char* d, const char* s) throw ();
+
+class A { public: A (); ~A (); };
+
+inline char * B (char *s, const char *t)
+{ return ::strcpy (s, t); }
+
+class C { int D (void); int E; };
+
+int C::D (void)
+{
+  A a;
+  try
+    {
+      char z[22];
+      if (this->E) B (z, "");
+      return 0;
+    }
+  catch (int &f) { return -1; }
+}
diff --git a/gcc/testsuite/g++.dg/opt/pr17724-4.C b/gcc/testsuite/g++.dg/opt/pr17724-4.C
new file mode 100644 (file)
index 0000000..7828a25
--- /dev/null
@@ -0,0 +1,24 @@
+// PR tree-optimization/17724
+// { dg-do compile }
+// { dg-options "-O2" }
+
+extern "C" char *strcpy (char* d, const char* s);
+
+class A { public: A (); ~A (); };
+
+inline char * B (char *s, const char *t)
+{ return ::strcpy (s, t); }
+
+class C { int D (void); int E; };
+
+int C::D (void)
+{
+  A a;
+  try
+    {
+      char z[22];
+      if (this->E) B (z, "");
+      return 0;
+    }
+  catch (int &f) { return -1; }
+}
diff --git a/gcc/testsuite/g++.dg/opt/pr17724-5.C b/gcc/testsuite/g++.dg/opt/pr17724-5.C
new file mode 100644 (file)
index 0000000..5ce3038
--- /dev/null
@@ -0,0 +1,24 @@
+// PR tree-optimization/17724
+// { dg-do compile }
+// { dg-options "-O2" }
+
+extern char *strcpy (char* d, const char* s) throw ();
+
+class A { public: A (); ~A (); };
+
+inline char * B (char *s, const char *t)
+{ return ::strcpy (s, t); }
+
+class C { int D (void); int E; };
+
+int C::D (void)
+{
+  A a;
+  try
+    {
+      char z[22];
+      if (this->E) B (z, "");
+      return 0;
+    }
+  catch (int &f) { return -1; }
+}
diff --git a/gcc/testsuite/g++.dg/opt/pr17724-6.C b/gcc/testsuite/g++.dg/opt/pr17724-6.C
new file mode 100644 (file)
index 0000000..f95c4d0
--- /dev/null
@@ -0,0 +1,24 @@
+// PR tree-optimization/17724
+// { dg-do compile }
+// { dg-options "-O2" }
+
+extern char *strcpy (char* d, const char* s);
+
+class A { public: A (); ~A (); };
+
+inline char * B (char *s, const char *t)
+{ return ::strcpy (s, t); }
+
+class C { int D (void); int E; };
+
+int C::D (void)
+{
+  A a;
+  try
+    {
+      char z[22];
+      if (this->E) B (z, "");
+      return 0;
+    }
+  catch (int &f) { return -1; }
+}
index 2de38f7692e82fe5dc172791d128976dd8d4d148..293b24e1957c7bbb3ff9c7bfb32434a2d006eb70 100644 (file)
@@ -5016,6 +5016,26 @@ tree_purge_dead_eh_edges (basic_block bb)
        ei_next (&ei);
     }
 
+  /* Removal of dead EH edges might change dominators of not
+     just immediate successors.  E.g. when bb1 is changed so that
+     it no longer can throw and bb1->bb3 and bb1->bb4 are dead
+     eh edges purged by this function in:
+           0
+         / \
+        v   v
+        1-->2
+        / \  |
+       v   v |
+       3-->4 |
+        \    v
+        --->5
+            |
+            -
+     idom(bb5) must be recomputed.  For now just free the dominance
+     info.  */
+  if (changed)
+    free_dominance_info (CDI_DOMINATORS);
+
   return changed;
 }