public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-3743] [Ada] Remove if_expression
Date: Tue, 21 Sep 2021 15:27:10 +0000 (GMT)	[thread overview]
Message-ID: <20210921152710.395853858412@sourceware.org> (raw)

https://gcc.gnu.org/g:911b00fba9a092448035c0951d5b229819124d20

commit r12-3743-g911b00fba9a092448035c0951d5b229819124d20
Author: Bob Duff <duff@adacore.com>
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;


                 reply	other threads:[~2021-09-21 15:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210921152710.395853858412@sourceware.org \
    --to=pmderodat@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).