Commit 92f5c135 by Jason Merrill Committed by Jason Merrill

except.c (expand_start_catch_block): Fix catching a reference to pointer.

	* except.c (expand_start_catch_block): Fix catching a reference
	to pointer.

	* 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.

From-SVN: r16726
parent f4744807
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
......
......@@ -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,
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment