This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR tree-optimization/17724


Hi!

This patch seems to fix the testcase (bootstrap/regtest still pending),
though I'm not sure if it is the right thing or the dominator should be
recomputed somewhere else (either at lower level, e.g. in remove_edge
or ssa_remove_edge, or in tree_purge_dead_eh_edges callers, or in
cleanup_tree_cfg).

2004-09-30  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/17724
	* tree-cfg.c (tree_purge_dead_eh_edges): Recompute dominator for the
	EH block.

	* g++.dg/opt/pr17724-1.C: New test.
	* g++.dg/opt/pr17724-2.C: New test.

--- gcc/tree-cfg.c.jj	2004-09-28 10:19:49.000000000 +0200
+++ gcc/tree-cfg.c	2004-09-30 00:16:27.722706542 +0200
@@ -5067,7 +5067,11 @@ tree_purge_dead_eh_edges (basic_block bb
     {
       if (e->flags & EDGE_EH)
 	{
+	  basic_block dest = e->dest, dom;
+
 	  ssa_remove_edge (e);
+	  dom = recount_dominator (CDI_DOMINATORS, dest);
+	  set_immediate_dominator (CDI_DOMINATORS, dest, dom);
 	  changed = true;
 	}
       else
--- gcc/testsuite/g++.dg/opt/pr17724-1.C.jj	2004-09-30 00:20:11.520994862 +0200
+++ gcc/testsuite/g++.dg/opt/pr17724-1.C	2004-09-30 00:20:24.014777890 +0200
@@ -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;
+}
--- gcc/testsuite/g++.dg/opt/pr17724-2.C.jj	2004-09-30 00:20:11.000000000 +0200
+++ gcc/testsuite/g++.dg/opt/pr17724-2.C	2004-09-30 00:20:04.000000000 +0200
@@ -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;
+}

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]