OSDN Git Service

* gcc-interface/utils2.c (build_cond_expr): Take the address and
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 11 Apr 2010 11:23:32 +0000 (11:23 +0000)
committerMasaki Muranaka <monaka@monami-software.com>
Sun, 23 May 2010 05:31:26 +0000 (14:31 +0900)
dereference if the result type is passed by reference.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158201 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/gcc-interface/utils2.c

index 3643811..626eb4f 100644 (file)
@@ -1,5 +1,10 @@
 2010-04-11  Eric Botcazou  <ebotcazou@adacore.com>
 
+       * gcc-interface/utils2.c (build_cond_expr): Take the address and
+       dereference if the result type is passed by reference.
+
+2010-04-11  Eric Botcazou  <ebotcazou@adacore.com>
+
        * gcc-interface/trans.c (Case_Statement_to_gnu): Bool-ify variable.
        (gnat_to_gnu) <N_Null_Statement>: When not optimizing, generate a
        goto to the next statement.
index 0f7f4e9..b7b24b9 100644 (file)
@@ -1337,9 +1337,10 @@ build_cond_expr (tree result_type, tree condition_operand,
 
   /* If the result type is unconstrained, take the address of the operands and
      then dereference the result.  Likewise if the result type is passed by
-     reference, but this is natively handled in the gimplifier.  */
+     reference because creating a temporary of this type is not allowed.  */
   if (TREE_CODE (result_type) == UNCONSTRAINED_ARRAY_TYPE
-      || CONTAINS_PLACEHOLDER_P (TYPE_SIZE (result_type)))
+      || CONTAINS_PLACEHOLDER_P (TYPE_SIZE (result_type))
+      || (AGGREGATE_TYPE_P (result_type) && TYPE_BY_REFERENCE_P (result_type)))
     {
       result_type = build_pointer_type (result_type);
       true_operand = build_unary_op (ADDR_EXPR, result_type, true_operand);