Commit bb021771 by Eric Botcazou Committed by Eric Botcazou

trans.c (gnat_gimplify_expr): Deal with CALL_EXPR.

	* gcc-interface/trans.c (gnat_gimplify_expr) <ADDR_EXPR>: Deal with
	CALL_EXPR.

From-SVN: r162014
parent 85e693aa
2010-07-09 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (gnat_gimplify_expr) <ADDR_EXPR>: Deal with
CALL_EXPR.
2010-07-08 Manuel López-Ibáñez <manu@gcc.gnu.org> 2010-07-08 Manuel López-Ibáñez <manu@gcc.gnu.org>
* gcc-interface/utils.c: Include diagnostic-core.h in every file * gcc-interface/utils.c: Include diagnostic-core.h in every file
......
...@@ -5988,21 +5988,21 @@ gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p, ...@@ -5988,21 +5988,21 @@ gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p,
case ADDR_EXPR: case ADDR_EXPR:
op = TREE_OPERAND (expr, 0); op = TREE_OPERAND (expr, 0);
if (TREE_CODE (op) == CONSTRUCTOR) /* If we are taking the address of a constant CONSTRUCTOR, make sure it
{ is put into static memory. We know that it's going to be read-only
/* If we are taking the address of a constant CONSTRUCTOR, make sure given the semantics we have and it must be in static memory when the
it is put into static memory. We know it's going to be read-only reference is in an elaboration procedure. */
given the semantics we have and it must be in static memory when if (TREE_CODE (op) == CONSTRUCTOR && TREE_CONSTANT (op))
the reference is in an elaboration procedure. */
if (TREE_CONSTANT (op))
{ {
tree addr = build_fold_addr_expr (tree_output_constant_def (op)); tree addr = build_fold_addr_expr (tree_output_constant_def (op));
*expr_p = fold_convert (TREE_TYPE (expr), addr); *expr_p = fold_convert (TREE_TYPE (expr), addr);
return GS_ALL_DONE;
} }
/* Otherwise explicitly create the local temporary. That's required /* Otherwise, if we are taking the address of a non-constant CONSTRUCTOR
or of a call, explicitly create the local temporary. That's required
if the type is passed by reference. */ if the type is passed by reference. */
else if (TREE_CODE (op) == CONSTRUCTOR || TREE_CODE (op) == CALL_EXPR)
{ {
tree mod, new_var = create_tmp_var_raw (TREE_TYPE (op), "C"); tree mod, new_var = create_tmp_var_raw (TREE_TYPE (op), "C");
TREE_ADDRESSABLE (new_var) = 1; TREE_ADDRESSABLE (new_var) = 1;
...@@ -6013,8 +6013,6 @@ gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p, ...@@ -6013,8 +6013,6 @@ gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p,
TREE_OPERAND (expr, 0) = new_var; TREE_OPERAND (expr, 0) = new_var;
recompute_tree_invariant_for_addr_expr (expr); recompute_tree_invariant_for_addr_expr (expr);
}
return GS_ALL_DONE; return GS_ALL_DONE;
} }
......
2010-07-09 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/atomic3.adb: New test.
2010-07-09 Jakub Jelinek <jakub@redhat.com> 2010-07-09 Jakub Jelinek <jakub@redhat.com>
Denys Vlasenko <dvlasenk@redhat.com> Denys Vlasenko <dvlasenk@redhat.com>
Bernhard Reutner-Fischer <aldot@gcc.gnu.org> Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
......
-- { dg-do compile }
procedure Atomic3 is
type Unsigned_32_T is mod 2 ** 32;
for Unsigned_32_T'Size use 32;
type Id_T is (One, Two, Three);
type Array_T is array (Id_T) of Unsigned_32_T;
pragma Atomic_Components (Array_T);
A : Array_T := (others => 0);
function Get_Array return Array_T is
begin
return A;
end;
X : Array_T;
begin
X := Get_Array;
end;
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