diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2020-04-16 23:42:13 +0200 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-06-17 04:14:19 -0400 |
commit | 67b2ed8e563ac254e6a7952cb7bff1d0f2d0a89a (patch) | |
tree | ccc4e8e98661400853659dca93fea27a8c059b12 | |
parent | 765005dd6791889af2731073bb7c5f6305d14f01 (diff) | |
download | gcc-67b2ed8e563ac254e6a7952cb7bff1d0f2d0a89a.zip gcc-67b2ed8e563ac254e6a7952cb7bff1d0f2d0a89a.tar.gz gcc-67b2ed8e563ac254e6a7952cb7bff1d0f2d0a89a.tar.bz2 |
[Ada] Fix incorrect operand sharing after expansion
2020-06-17 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* exp_ch4.adb (Expand_N_Op_Expon): Replace all occurrences of
the original right operand with the relocated version.
-rw-r--r-- | gcc/ada/exp_ch4.adb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 752a15f..e7db7b0 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -8778,8 +8778,7 @@ package body Exp_Ch4 is -- Determine range to see if it can be larger than MaxS - Determine_Range - (Right_Opnd (N), OK, Lo, Hi, Assume_Valid => True); + Determine_Range (Exp, OK, Lo, Hi, Assume_Valid => True); TestS := (not OK) or else Hi > MaxS; -- Signed integer case @@ -8796,7 +8795,7 @@ package body Exp_Ch4 is Make_Raise_Constraint_Error (Loc, Condition => Make_Op_Gt (Loc, - Left_Opnd => Duplicate_Subexpr (Right_Opnd (N)), + Left_Opnd => Duplicate_Subexpr (Exp), Right_Opnd => Make_Integer_Literal (Loc, MaxS)), Reason => CE_Overflow_Check_Failed)); end if; @@ -8806,7 +8805,7 @@ package body Exp_Ch4 is Rewrite (N, Make_Op_Shift_Left (Loc, Left_Opnd => Make_Integer_Literal (Loc, Uint_1), - Right_Opnd => Right_Opnd (N))); + Right_Opnd => Exp)); -- Modular integer case @@ -8824,7 +8823,7 @@ package body Exp_Ch4 is Test_Gt := Make_Op_Gt (Loc, - Left_Opnd => Duplicate_Subexpr (Right_Opnd (N)), + Left_Opnd => Duplicate_Subexpr (Exp), Right_Opnd => Make_Integer_Literal (Loc, MaxS)); Rewrite (N, @@ -8834,7 +8833,7 @@ package body Exp_Ch4 is Make_Integer_Literal (Loc, Uint_0), Make_Op_Shift_Left (Loc, Left_Opnd => Make_Integer_Literal (Loc, Uint_1), - Right_Opnd => Right_Opnd (N))))); + Right_Opnd => Exp)))); -- If we know shift count cannot be greater than MaxS, then -- it is safe to just rewrite as a shift with no test. @@ -8843,7 +8842,7 @@ package body Exp_Ch4 is Rewrite (N, Make_Op_Shift_Left (Loc, Left_Opnd => Make_Integer_Literal (Loc, Uint_1), - Right_Opnd => Right_Opnd (N))); + Right_Opnd => Exp)); end if; end if; |