aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/trans.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/gcc-interface/trans.c')
-rw-r--r--gcc/ada/gcc-interface/trans.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index da1da50..f5cc318 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -7587,16 +7587,15 @@ gnat_to_gnu (Node_Id gnat_node)
gnu_rhs = convert (gnu_type, gnu_rhs);
}
- /* Instead of expanding overflow checks for addition, subtraction
- and multiplication itself, the front end will leave this to
- the back end when Backend_Overflow_Checks_On_Target is set. */
+ /* For signed integer addition, subtraction and multiplication, do an
+ overflow check if required. */
if (Do_Overflow_Check (gnat_node)
- && Backend_Overflow_Checks_On_Target
&& (code == PLUS_EXPR || code == MINUS_EXPR || code == MULT_EXPR)
&& !TYPE_UNSIGNED (gnu_type)
&& !FLOAT_TYPE_P (gnu_type))
- gnu_result = build_binary_op_trapv (code, gnu_type,
- gnu_lhs, gnu_rhs, gnat_node);
+ gnu_result
+ = build_binary_op_trapv (code, gnu_type, gnu_lhs, gnu_rhs,
+ gnat_node);
else
{
/* Some operations, e.g. comparisons of arrays, generate complex
@@ -7657,19 +7656,17 @@ gnat_to_gnu (Node_Id gnat_node)
gnu_expr = gnat_to_gnu (Right_Opnd (gnat_node));
gnu_result_type = get_unpadded_type (Etype (gnat_node));
- /* Instead of expanding overflow checks for negation and absolute
- value itself, the front end will leave this to the back end
- when Backend_Overflow_Checks_On_Target is set. */
+ /* For signed integer negation and absolute value, do an overflow check
+ if required. */
if (Do_Overflow_Check (gnat_node)
- && Backend_Overflow_Checks_On_Target
&& !TYPE_UNSIGNED (gnu_result_type)
&& !FLOAT_TYPE_P (gnu_result_type))
gnu_result
- = build_unary_op_trapv (gnu_codes[kind],
- gnu_result_type, gnu_expr, gnat_node);
+ = build_unary_op_trapv (gnu_codes[kind], gnu_result_type, gnu_expr,
+ gnat_node);
else
- gnu_result = build_unary_op (gnu_codes[kind],
- gnu_result_type, gnu_expr);
+ gnu_result
+ = build_unary_op (gnu_codes[kind], gnu_result_type, gnu_expr);
break;
case N_Allocator: