Commit 0b3467c4 by Eric Botcazou Committed by Eric Botcazou

trans.c (call_to_gnu): Open a nesting level if this is a statement.

	* gcc-interface/trans.c (call_to_gnu): Open a nesting level if this is
	a statement.  Otherwise, if at top-level, push the processing of the
	elaboration routine.  In the misaligned case, issue the error messages
	again on entry and create the temporary explicitly.  Do not issue them
	for CONSTRUCTORs.
	For a function call, emit the range check if necessary.
	In the copy-in copy-out case, create the temporary for the return
	value explicitly.
	Do not unnecessarily convert by-ref parameters to the formal's type.
	Remove obsolete guards in conditions.
	(gnat_to_gnu) <N_Assignment_Statement>: For a function call, pass the
	target to call_to_gnu in all cases.
	(gnat_gimplify_expr) <ADDR_EXPR>: Remove handling of SAVE_EXPR.
	(addressable_p) <CONSTRUCTOR>: Return false if not static.
	<COMPOUND_EXPR>: New case.
	* gcc-interface/utils2.c (build_unary_op) <ADDR_EXPR>: Fold a compound
	expression if it has unconstrained array type.
	(gnat_mark_addressable) <COMPOUND_EXPR>: New case.
	(gnat_stabilize_reference) <COMPOUND_EXPR>: Stabilize operands on an
	individual basis.

From-SVN: r158371
parent a09d56d8
2010-04-15 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (call_to_gnu): Open a nesting level if this is
a statement. Otherwise, if at top-level, push the processing of the
elaboration routine. In the misaligned case, issue the error messages
again on entry and create the temporary explicitly. Do not issue them
for CONSTRUCTORs.
For a function call, emit the range check if necessary.
In the copy-in copy-out case, create the temporary for the return
value explicitly.
Do not unnecessarily convert by-ref parameters to the formal's type.
Remove obsolete guards in conditions.
(gnat_to_gnu) <N_Assignment_Statement>: For a function call, pass the
target to call_to_gnu in all cases.
(gnat_gimplify_expr) <ADDR_EXPR>: Remove handling of SAVE_EXPR.
(addressable_p) <CONSTRUCTOR>: Return false if not static.
<COMPOUND_EXPR>: New case.
* gcc-interface/utils2.c (build_unary_op) <ADDR_EXPR>: Fold a compound
expression if it has unconstrained array type.
(gnat_mark_addressable) <COMPOUND_EXPR>: New case.
(gnat_stabilize_reference) <COMPOUND_EXPR>: Stabilize operands on an
individual basis.
2010-04-15 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (gigi): Do not start statement group.
(Compilation_Unit_to_gnu): Set current_function_decl to NULL.
Start statement group and push binding level here...
......
......@@ -1025,6 +1025,22 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand)
TREE_TYPE (result) = type = build_pointer_type (type);
break;
case COMPOUND_EXPR:
/* Fold a compound expression if it has unconstrained array type
since the middle-end cannot handle it. But we don't it in the
general case because it may introduce aliasing issues if the
first operand is an indirect assignment and the second operand
the corresponding address, e.g. for an allocator. */
if (TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE)
{
result = build_unary_op (ADDR_EXPR, result_type,
TREE_OPERAND (operand, 1));
result = build2 (COMPOUND_EXPR, TREE_TYPE (result),
TREE_OPERAND (operand, 0), result);
break;
}
goto common;
case ARRAY_REF:
case ARRAY_RANGE_REF:
case COMPONENT_REF:
......@@ -2119,6 +2135,10 @@ gnat_mark_addressable (tree t)
t = TREE_OPERAND (t, 0);
break;
case COMPOUND_EXPR:
t = TREE_OPERAND (t, 1);
break;
case CONSTRUCTOR:
TREE_ADDRESSABLE (t) = 1;
return true;
......@@ -2377,10 +2397,17 @@ gnat_stabilize_reference (tree ref, bool force, bool *success)
break;
case CALL_EXPR:
case COMPOUND_EXPR:
result = gnat_stabilize_reference_1 (ref, force);
break;
case COMPOUND_EXPR:
result = build2 (COMPOUND_EXPR, type,
gnat_stabilize_reference (TREE_OPERAND (ref, 0), force,
success),
gnat_stabilize_reference_1 (TREE_OPERAND (ref, 1),
force));
break;
case CONSTRUCTOR:
/* Constructors with 1 element are used extensively to formally
convert objects to special wrapping types. */
......
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