aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils2.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2010-04-15 12:40:15 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2010-04-15 12:40:15 +0000
commit0b3467c4a3424bc3b960336dd87160db7a481f99 (patch)
tree79c65e316aef5e9cf69d332b87560705466eeb62 /gcc/ada/gcc-interface/utils2.c
parenta09d56d8c7cf30531965eb461d0e58adcb7d72d9 (diff)
downloadgcc-0b3467c4a3424bc3b960336dd87160db7a481f99.zip
gcc-0b3467c4a3424bc3b960336dd87160db7a481f99.tar.gz
gcc-0b3467c4a3424bc3b960336dd87160db7a481f99.tar.bz2
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
Diffstat (limited to 'gcc/ada/gcc-interface/utils2.c')
-rw-r--r--gcc/ada/gcc-interface/utils2.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c
index dbe83ed..8257507 100644
--- a/gcc/ada/gcc-interface/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -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. */