Commit cf694b8f by Jason Merrill Committed by Jason Merrill

* init.c (build_new_1): suspend_momentary while calculating size.

From-SVN: r26953
parent 7a8f9fa9
1999-05-16 Jason Merrill <jason@yorick.cygnus.com> 1999-05-16 Jason Merrill <jason@yorick.cygnus.com>
* parse.y (direct_new_declarator): Make the first one a
nonmomentary_expr, too.
* init.c (build_new): suspend_momentary while we're calculating
the size.
(build_new_1): Likewise. Don't copy size.
* decl2.c (finish_objects): Don't use .?tors.* if we don't have * decl2.c (finish_objects): Don't use .?tors.* if we don't have
ASM_OUTPUT_CONSTRUCTOR. ASM_OUTPUT_CONSTRUCTOR.
...@@ -10,12 +16,6 @@ ...@@ -10,12 +16,6 @@
(grokdeclarator): Adjust. (grokdeclarator): Adjust.
* cp-tree.h: Adjust. * cp-tree.h: Adjust.
* parse.y (direct_new_declarator): Make the first one a
nonmomentary_expr, too.
* init.c (build_new): suspend_momentary while we're calculating
the size.
(build_new_1): Don't copy size.
1999-05-16 Mark Mitchell <mark@codesourcery.com> 1999-05-16 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (permanent_p): New function. * cp-tree.h (permanent_p): New function.
......
...@@ -2134,6 +2134,7 @@ build_new_1 (exp) ...@@ -2134,6 +2134,7 @@ build_new_1 (exp)
int use_cookie, nothrow, check_new; int use_cookie, nothrow, check_new;
int use_global_new; int use_global_new;
int use_java_new = 0; int use_java_new = 0;
int susp = 0;
placement = TREE_OPERAND (exp, 0); placement = TREE_OPERAND (exp, 0);
type = TREE_OPERAND (exp, 1); type = TREE_OPERAND (exp, 1);
...@@ -2163,11 +2164,13 @@ build_new_1 (exp) ...@@ -2163,11 +2164,13 @@ build_new_1 (exp)
if (!complete_type_or_else (true_type, exp)) if (!complete_type_or_else (true_type, exp))
return error_mark_node; return error_mark_node;
susp = suspend_momentary ();
if (has_array) if (has_array)
size = fold (build_binary_op (MULT_EXPR, size_in_bytes (true_type), size = fold (build_binary_op (MULT_EXPR, size_in_bytes (true_type),
nelts)); nelts));
else else
size = size_in_bytes (type); size = size_in_bytes (type);
resume_momentary (susp);
if (TREE_CODE (true_type) == VOID_TYPE) if (TREE_CODE (true_type) == VOID_TYPE)
{ {
...@@ -2250,8 +2253,6 @@ build_new_1 (exp) ...@@ -2250,8 +2253,6 @@ build_new_1 (exp)
} }
else else
{ {
int susp = 0;
if (flag_exceptions) if (flag_exceptions)
/* We will use RVAL when generating an exception handler for /* We will use RVAL when generating an exception handler for
this new-expression, so we must save it. */ this new-expression, so we must save it. */
...@@ -2424,7 +2425,7 @@ build_new_1 (exp) ...@@ -2424,7 +2425,7 @@ build_new_1 (exp)
int flags = LOOKUP_NORMAL | (use_global_new * LOOKUP_GLOBAL); int flags = LOOKUP_NORMAL | (use_global_new * LOOKUP_GLOBAL);
/* All cleanups must last longer than normal. */ /* All cleanups must last longer than normal. */
int yes = suspend_momentary (); susp = suspend_momentary ();
if (placement) if (placement)
{ {
...@@ -2438,7 +2439,7 @@ build_new_1 (exp) ...@@ -2438,7 +2439,7 @@ build_new_1 (exp)
cleanup = build_op_delete_call (dcode, alloc_node, size, flags, fn); cleanup = build_op_delete_call (dcode, alloc_node, size, flags, fn);
resume_momentary (yes); resume_momentary (susp);
/* Ack! First we allocate the memory. Then we set our sentry /* Ack! First we allocate the memory. Then we set our sentry
variable to true, and expand a cleanup that deletes the memory variable to true, and expand a cleanup that deletes the memory
...@@ -2452,11 +2453,11 @@ build_new_1 (exp) ...@@ -2452,11 +2453,11 @@ build_new_1 (exp)
begin = get_target_expr (boolean_true_node); begin = get_target_expr (boolean_true_node);
sentry = TREE_OPERAND (begin, 0); sentry = TREE_OPERAND (begin, 0);
yes = suspend_momentary (); susp = suspend_momentary ();
TREE_OPERAND (begin, 2) TREE_OPERAND (begin, 2)
= build (COND_EXPR, void_type_node, sentry, = build (COND_EXPR, void_type_node, sentry,
cleanup, void_zero_node); cleanup, void_zero_node);
resume_momentary (yes); resume_momentary (susp);
rval = get_target_expr (rval); rval = get_target_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