From bf7d31c1a6719fbf1e36d6dde187245636d8d558 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 6 Apr 2005 00:57:39 -0400 Subject: [PATCH] re PR c++/19312 (ICE in stabilize_call when throwing a copy) PR c++/19312 * tree.c (stabilize_init): Don't bother trying to stabilize something with no side-effects. From-SVN: r97691 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/tree.c | 5 ++++- gcc/testsuite/g++.dg/eh/throw3.C | 8 ++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/eh/throw3.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f37530d94ce..aec76819098 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2005-04-06 Jason Merrill + + PR c++/19312 + * tree.c (stabilize_init): Don't bother trying to stabilize + something with no side-effects. + 2005-04-05 Mark Mitchell PR c++/20763 diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 8b0d9aa872f..5d80d596162 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -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 index 00000000000..3417eeb3dcf --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/throw3.C @@ -0,0 +1,8 @@ +// PR c++/19312 + +struct A {}; + +void foo(A a) +{ + throw (A)a; +} -- 2.30.2