OSDN Git Service

PR c++/19312
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Apr 2005 04:57:39 +0000 (04:57 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Apr 2005 04:57:39 +0000 (04:57 +0000)
        * tree.c (stabilize_init): Don't bother trying to stabilize
        something with no side-effects.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@97691 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/g++.dg/eh/throw3.C [new file with mode: 0644]

index f37530d..aec7681 100644 (file)
@@ -1,3 +1,9 @@
+2005-04-06  Jason Merrill  <jason@redhat.com>
+
+       PR c++/19312
+       * tree.c (stabilize_init): Don't bother trying to stabilize
+       something with no side-effects.
+
 2005-04-05  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/20763
index 8b0d9aa..5d80d59 100644 (file)
@@ -2257,7 +2257,10 @@ stabilize_init (tree init, tree *initp)
       if (TREE_CODE (t) == COND_EXPR)
        return false;
 
-      stabilize_call (t, initp);
+      /* The TARGET_EXPR might be initializing via bitwise copy from
+        another variable; leave that alone.  */
+      if (TREE_SIDE_EFFECTS (t))
+       stabilize_call (t, initp);
     }
 
   return true;
diff --git a/gcc/testsuite/g++.dg/eh/throw3.C b/gcc/testsuite/g++.dg/eh/throw3.C
new file mode 100644 (file)
index 0000000..3417eeb
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/19312
+
+struct A {};
+
+void foo(A a)
+{
+    throw (A)a;
+}