From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id 395853858412; Tue, 21 Sep 2021 15:27:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 395853858412 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-3743] [Ada] Remove if_expression X-Act-Checkin: gcc X-Git-Author: Bob Duff X-Git-Refname: refs/heads/master X-Git-Oldrev: b12d18a82597b97cbaccbac4253e8837f339d9a0 X-Git-Newrev: 911b00fba9a092448035c0951d5b229819124d20 Message-Id: <20210921152710.395853858412@sourceware.org> Date: Tue, 21 Sep 2021 15:27:10 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2021 15:27:10 -0000 https://gcc.gnu.org/g:911b00fba9a092448035c0951d5b229819124d20 commit r12-3743-g911b00fba9a092448035c0951d5b229819124d20 Author: Bob Duff Date: Tue Jul 6 16:56:58 2021 -0400 [Ada] Remove if_expression gcc/ada/ * sem_eval.adb (Fold_Shift): Replace an if_expression with an if_statement. Diff: --- gcc/ada/sem_eval.adb | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index da51caa30a1..6f814069f3c 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -5063,12 +5063,20 @@ package body Sem_Eval is -- result is always positive, even if the original operand was -- negative. - Fold_Uint - (N, - (Expr_Value (Left) + - (if Expr_Value (Left) >= Uint_0 then Uint_0 else Modulus)) - / (Uint_2 ** Expr_Value (Right)), - Static => Static); + declare + M : Unat; + begin + if Expr_Value (Left) >= Uint_0 then + M := Uint_0; + else + M := Modulus; + end if; + + Fold_Uint + (N, + (Expr_Value (Left) + M) / (Uint_2 ** Expr_Value (Right)), + Static => Static); + end; end if; elsif Op = N_Op_Shift_Right_Arithmetic then Check_Elab_Call;