aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2013-08-13 17:13:47 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2013-08-13 17:13:47 +0000
commitbb29e9ff3e42ee0bd23cf85cbce0e459213b19d0 (patch)
tree6f864ed6b97c9671f21543ea0f182b047174097a /gcc/ada/gcc-interface
parent761a8eb70ae4108515bd7d756832744350b4ff7a (diff)
downloadgcc-bb29e9ff3e42ee0bd23cf85cbce0e459213b19d0.zip
gcc-bb29e9ff3e42ee0bd23cf85cbce0e459213b19d0.tar.gz
gcc-bb29e9ff3e42ee0bd23cf85cbce0e459213b19d0.tar.bz2
trans.c (Call_to_gnu): Deal with specific conditional expressions for misaligned actual parameters.
* gcc-interface/trans.c (Call_to_gnu): Deal with specific conditional expressions for misaligned actual parameters. From-SVN: r201700
Diffstat (limited to 'gcc/ada/gcc-interface')
-rw-r--r--gcc/ada/gcc-interface/trans.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index fdd59a8..5c1038a 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -4022,9 +4022,19 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target,
/* Set up to move the copy back to the original if needed. */
if (!in_param)
{
- gnu_stmt = build_binary_op (MODIFY_EXPR, NULL_TREE, gnu_orig,
- gnu_temp);
+ /* If the original is a COND_EXPR whose first arm isn't meant to
+ be further used, just deal with the second arm. This is very
+ likely the conditional expression built for a check. */
+ if (TREE_CODE (gnu_orig) == COND_EXPR
+ && TREE_CODE (TREE_OPERAND (gnu_orig, 1)) == COMPOUND_EXPR
+ && integer_zerop
+ (TREE_OPERAND (TREE_OPERAND (gnu_orig, 1), 1)))
+ gnu_orig = TREE_OPERAND (gnu_orig, 2);
+
+ gnu_stmt
+ = build_binary_op (MODIFY_EXPR, NULL_TREE, gnu_orig, gnu_temp);
set_expr_location_from_node (gnu_stmt, gnat_node);
+
append_to_statement_list (gnu_stmt, &gnu_after_list);
}
}