aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2021-07-06 16:56:58 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2021-09-21 15:25:00 +0000
commit911b00fba9a092448035c0951d5b229819124d20 (patch)
tree3beee6603b038156dcac368dc21f996a077730b8
parentb12d18a82597b97cbaccbac4253e8837f339d9a0 (diff)
downloadgcc-911b00fba9a092448035c0951d5b229819124d20.zip
gcc-911b00fba9a092448035c0951d5b229819124d20.tar.gz
gcc-911b00fba9a092448035c0951d5b229819124d20.tar.bz2
[Ada] Remove if_expression
gcc/ada/ * sem_eval.adb (Fold_Shift): Replace an if_expression with an if_statement.
-rw-r--r--gcc/ada/sem_eval.adb20
1 files changed, 14 insertions, 6 deletions
diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb
index da51caa..6f81406 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;