trans.c (gnat_to_gnu): Remove superfluous tests on Backend_Overflow_Checks_On_Target and rework comments.

* gcc-interface/trans.c (gnat_to_gnu): Remove superfluous tests on
	Backend_Overflow_Checks_On_Target and rework comments.

From-SVN: r271689
This commit is contained in:
Eric Botcazou 2019-05-28 08:13:37 +00:00 committed by Eric Botcazou
parent 81edaf2fc6
commit f552aa626f
2 changed files with 16 additions and 14 deletions

View file

@ -1,3 +1,8 @@
2019-05-28 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (gnat_to_gnu): Remove superfluous tests on
Backend_Overflow_Checks_On_Target and rework comments.
2019-05-28 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (walk_nesting_tree): New static function.

View file

@ -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: