From: Eric Botcazou Date: Tue, 28 May 2019 08:13:37 +0000 (+0000) Subject: trans.c (gnat_to_gnu): Remove superfluous tests on Backend_Overflow_Checks_On_Target... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f552aa626fbfa268b819395d1c5d25ca3ca78428;p=gcc.git 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 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 608a417ff45..4db444ab457 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-05-28 Eric Botcazou + + * gcc-interface/trans.c (gnat_to_gnu): Remove superfluous tests on + Backend_Overflow_Checks_On_Target and rework comments. + 2019-05-28 Eric Botcazou * gcc-interface/trans.c (walk_nesting_tree): New static function. diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index da1da506beb..f5cc31876a5 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: