aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2010-04-11 11:23:32 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2010-04-11 11:23:32 +0000
commit87fa3d342b62a632f1e44008c18bc60a9ac90af1 (patch)
treee76d865e667913633f294e217b6416104244345e /gcc
parent9c69c3afd6ba8ed4814f5c1aa1b5d0ea12a8eb11 (diff)
downloadgcc-87fa3d342b62a632f1e44008c18bc60a9ac90af1.zip
gcc-87fa3d342b62a632f1e44008c18bc60a9ac90af1.tar.gz
gcc-87fa3d342b62a632f1e44008c18bc60a9ac90af1.tar.bz2
utils2.c (build_cond_expr): Take the address and dereference if the result type is passed by reference.
* gcc-interface/utils2.c (build_cond_expr): Take the address and dereference if the result type is passed by reference. From-SVN: r158201
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/gcc-interface/utils2.c8
2 files changed, 10 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 3643811..626eb4f 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -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.
diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c
index a6ec65f..29d60da 100644
--- a/gcc/ada/gcc-interface/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -1291,10 +1291,12 @@ build_cond_expr (tree result_type, tree condition_operand,
true_operand = convert (result_type, true_operand);
false_operand = convert (result_type, false_operand);
- /* If the result type is unconstrained, take the address of the operands
- and then dereference our result. */
+ /* 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 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);