diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2019-08-12 08:58:46 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-08-12 08:58:46 +0000 |
commit | 68c8d72a1aa31d750ddeb6a0eb3f472f1498a154 (patch) | |
tree | 9e9ebcb62a42d01acce70febd27a9afaa661e19b /gcc | |
parent | 52c9b7face987062527c612e0a65f084e43c85fd (diff) | |
download | gcc-68c8d72a1aa31d750ddeb6a0eb3f472f1498a154.zip gcc-68c8d72a1aa31d750ddeb6a0eb3f472f1498a154.tar.gz gcc-68c8d72a1aa31d750ddeb6a0eb3f472f1498a154.tar.bz2 |
[Ada] Fix incorrect Do_Range_Check on type conversion
This gets rid of another leak of the Do_Range_Check flag to the back-end
which is specific to expression functions. No functional changes.
2019-08-12 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* checks.adb (Activate_Range_Check): Remove redundant argument.
(Generate_Range_Check): Likewise.
(Apply_Float_Conversion_Check): Reset the Do_Range_Check flag on
entry and remove redundant condition.
From-SVN: r274279
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ada/checks.adb | 11 |
2 files changed, 15 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index cb3892f..749d96a 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2019-08-12 Eric Botcazou <ebotcazou@adacore.com> + + * checks.adb (Activate_Range_Check): Remove redundant argument. + (Generate_Range_Check): Likewise. + (Apply_Float_Conversion_Check): Reset the Do_Range_Check flag on + entry and remove redundant condition. + 2019-08-02 Alexandre Oliva <oliva@adacore.com> * libgnat/a-exexpr.adb (Begin_Handler_v1, End_Handler_v1): New. diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index 708bd9e..813ffec 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -445,7 +445,7 @@ package body Checks is procedure Activate_Range_Check (N : Node_Id) is begin - Set_Do_Range_Check (N, True); + Set_Do_Range_Check (N); Possible_Local_Raise (N, Standard_Constraint_Error); end Activate_Range_Check; @@ -2031,6 +2031,12 @@ package body Checks is return; end if; + -- Here we will generate an explicit range check, so we don't want to + -- set the Do_Range check flag, since the range check is taken care of + -- by the code we will generate. + + Set_Do_Range_Check (Ck_Node, False); + if not Compile_Time_Known_Value (LB) or not Compile_Time_Known_Value (HB) then @@ -2079,7 +2085,6 @@ package body Checks is if Nkind (Ck_Node) = N_Real_Literal and then Etype (Ck_Node) = Universal_Real and then Is_Integer_Type (Target_Typ) - and then Nkind (Parent (Ck_Node)) = N_Type_Conversion then declare Int_Val : constant Uint := UR_To_Uint (Realval (Ck_Node)); @@ -6936,7 +6941,7 @@ package body Checks is -- flag set, we do not want to generate the explicit range check code. if GNATprove_Mode or else not Expander_Active then - Set_Do_Range_Check (N, True); + Set_Do_Range_Check (N); return; end if; |