aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2006-02-12 11:02:00 -0500
committerJason Merrill <jason@gcc.gnu.org>2006-02-12 11:02:00 -0500
commiteecb13e8597ae0fc9d8770094ed7b9c951dba381 (patch)
tree5a0f9c02c5a834f9ebdd1947f4db63e428d57fa6 /gcc
parent1d327c160a08807deeab07d6b9af30115853eda1 (diff)
downloadgcc-eecb13e8597ae0fc9d8770094ed7b9c951dba381.zip
gcc-eecb13e8597ae0fc9d8770094ed7b9c951dba381.tar.gz
gcc-eecb13e8597ae0fc9d8770094ed7b9c951dba381.tar.bz2
re PR c++/24996 (ICE on throw code)
PR c++/24996 * except.c (build_throw): Add a CLEANUP_POINT_EXPR inside the TRY_CATCH_EXPR or MUST_NOT_THROW_EXPR. From-SVN: r110889
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/except.c1
-rw-r--r--gcc/testsuite/g++.dg/eh/cond3.C10
3 files changed, 17 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c85115e..cbab739 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2006-02-12 Jason Merrill <jason@redhat.com>
+
+ PR c++/24996
+ * except.c (build_throw): Add a CLEANUP_POINT_EXPR inside the
+ TRY_CATCH_EXPR or MUST_NOT_THROW_EXPR.
+
2006-02-10 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
* class.c (debug_class): Remove extern.
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index be7208e..9041342 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -722,6 +722,7 @@ build_throw (tree exp)
temp_expr = NULL_TREE;
stabilize_init (exp, &temp_expr);
+ exp = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (exp), exp);
if (elided)
exp = build2 (TRY_CATCH_EXPR, void_type_node, exp,
do_free_exception (ptr));
diff --git a/gcc/testsuite/g++.dg/eh/cond3.C b/gcc/testsuite/g++.dg/eh/cond3.C
new file mode 100644
index 0000000..0af4ecd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/eh/cond3.C
@@ -0,0 +1,10 @@
+// PR c++/24996
+// Bug: the cleanup for the A temporary was confusing the gimplifier
+// because of the TRY_CATCH_EXPR for the exception object.
+
+struct A { A(int); ~A(); };
+struct B { B(A); ~B(); };
+void foo(bool b)
+{
+ throw b ? B(1) : B(1);
+}