aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/gcc-interface/trans.c13
2 files changed, 14 insertions, 6 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index c8568f7..bd38c11 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,12 @@
2014-11-24 Eric Botcazou <ebotcazou@adacore.com>
+ * gcc-interface/trans.c (build_return_expr): Use INIT_EXPR instead of
+ MODIFY_EXPR to assign to the return object.
+ (finalize_nrv_r): Adjust to above change.
+ (finalize_nrv_unc_r): Likewise.
+
+2014-11-24 Eric Botcazou <ebotcazou@adacore.com>
+
* gcc-interface/trans.c (push_range_check_info): Replace early test
with assertion.
(Raise_Error_to_gnu): Do not call push_range_check_info if the loop
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 11aca57..d4c9c85 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -3135,7 +3135,7 @@ finalize_nrv_r (tree *tp, int *walk_subtrees, void *data)
nop, but differs from using NULL_TREE in that it indicates that we care
about the value of the RESULT_DECL. */
else if (TREE_CODE (t) == RETURN_EXPR
- && TREE_CODE (TREE_OPERAND (t, 0)) == MODIFY_EXPR)
+ && TREE_CODE (TREE_OPERAND (t, 0)) == INIT_EXPR)
{
tree ret_val = TREE_OPERAND (TREE_OPERAND (t, 0), 1), init_expr;
@@ -3224,7 +3224,7 @@ finalize_nrv_unc_r (tree *tp, int *walk_subtrees, void *data)
/* Change RETURN_EXPRs of NRVs to assign to the RESULT_DECL only the final
return value built by the allocator instead of the whole construct. */
else if (TREE_CODE (t) == RETURN_EXPR
- && TREE_CODE (TREE_OPERAND (t, 0)) == MODIFY_EXPR)
+ && TREE_CODE (TREE_OPERAND (t, 0)) == INIT_EXPR)
{
tree ret_val = TREE_OPERAND (TREE_OPERAND (t, 0), 1);
@@ -3437,7 +3437,7 @@ build_return_expr (tree ret_obj, tree ret_val)
RETURN_EXPR
|
- MODIFY_EXPR
+ INIT_EXPR
/ \
/ \
RET_OBJ ...
@@ -3446,13 +3446,14 @@ build_return_expr (tree ret_obj, tree ret_val)
of the RET_OBJ as the operation type. */
tree operation_type = TREE_TYPE (ret_obj);
- /* Convert the right operand to the operation type. Note that it's the
- same transformation as in the MODIFY_EXPR case of build_binary_op,
+ /* Convert the right operand to the operation type. Note that this is
+ the transformation applied in the INIT_EXPR case of build_binary_op,
with the assumption that the type cannot involve a placeholder. */
if (operation_type != TREE_TYPE (ret_val))
ret_val = convert (operation_type, ret_val);
- result_expr = build2 (MODIFY_EXPR, void_type_node, ret_obj, ret_val);
+ /* We always can use an INIT_EXPR for the return object. */
+ result_expr = build2 (INIT_EXPR, void_type_node, ret_obj, ret_val);
/* If the function returns an aggregate type, find out whether this is
a candidate for Named Return Value. If so, record it. Otherwise,