[PATCH] Fix PR middle-end/45310

Steven Bosscher stevenb.gcc@gmail.com
Fri Dec 17 16:55:00 GMT 2010


Hello,

When removing a statement, we should be removing it completely.

Bootstrapped and tested on ia64-unknown-linux-gnu. OK for trunk?

Ciao!
Steven


gcc/
        PR middle-end/45310
        * tree-ssa-phiprop.c (propagate_with_phi): Remove statement
        completely from the function, including EH traces.

testsuite/
        PR middle-end/45310
        * g++.dg/pr45310.C: New test.

I
Index: testsuite/g++.dg/pr45310.C
===================================================================
--- testsuite/g++.dg/pr45310.C  (revision 0)
+++ testsuite/g++.dg/pr45310.C  (revision 0)
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fnon-call-exceptions" }  */
+
+static inline const int &
+max (const int &a, const int &b)
+{
+  return a ? a : b;
+}
+
+static inline int
+baz ()
+{
+  return max (0, 0);
+}
+
+struct S
+{
+  ~S ()
+  {
+    baz ();
+  }
+};
+
+void bar ();
+void
+foo ()
+{
+  S s;
+  bar ();
+}
+
Index: tree-ssa-phiprop.c
===================================================================
--- tree-ssa-phiprop.c  (revision 167956)
+++ tree-ssa-phiprop.c  (working copy)
@@ -352,7 +352,7 @@ propagate_with_phi (basic_block bb, gimp
             want to delete it here we also have to delete all intermediate
             copies.  */
          gsi = gsi_for_stmt (use_stmt);
-         gsi_remove (&gsi, false);
+         gsi_remove (&gsi, true);

          phi_inserted = true;
        }



More information about the Gcc-patches mailing list