aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog12
-rw-r--r--gcc/cp/except.c7
-rw-r--r--gcc/cp/init.c7
3 files changed, 26 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 8af98a4..a129f0a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,15 @@
+Wed Nov 26 01:11:24 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * except.c (expand_start_catch_block): Fix catching a reference
+ to pointer.
+
+Tue Nov 25 11:28:21 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * init.c (build_new): Copy size to the saveable obstack.
+
+ * init.c (build_new): Stick a CLEANUP_POINT_EXPR inside the
+ TRY_CATCH_EXPR for now.
+
Mon Nov 24 12:15:55 1997 Jason Merrill <jason@yorick.cygnus.com>
* typeck.c (mark_addressable): Don't assume a FUNCTION_DECL
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index ff7a45b..56b2a41 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -614,6 +614,13 @@ expand_start_catch_block (declspecs, declarator)
init_type = build_reference_type (init_type);
exp = get_eh_value ();
+
+ /* Since pointers are passed by value, initialize a reference to
+ pointer catch parm with the address of the value slot. */
+ if (TREE_CODE (init_type) == REFERENCE_TYPE
+ && TREE_CODE (TREE_TYPE (init_type)) == POINTER_TYPE)
+ exp = build_unary_op (ADDR_EXPR, exp, 1);
+
exp = expr_tree_cons (NULL_TREE,
build_eh_type_type (TREE_TYPE (decl)),
expr_tree_cons (NULL_TREE,
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 7100b565..186b6c3 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -2736,12 +2736,19 @@ build_new (placement, decl, init, use_global_new)
if (placement)
flags |= LOOKUP_SPECULATIVELY;
+ /* Copy size to the saveable obstack. */
+ size = copy_node (size);
+
cleanup = build_op_delete_call (dcode, alloc_expr, size, flags);
resume_momentary (yes);
if (cleanup)
{
+ /* FIXME: this is a workaround for a crash due to overlapping
+ exception regions. Cleanups shouldn't really happen here. */
+ rval = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (rval), rval);
+
rval = build (TRY_CATCH_EXPR, TREE_TYPE (rval), rval, cleanup);
rval = build (COMPOUND_EXPR, TREE_TYPE (rval), alloc_expr, rval);
}