diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2019-08-12 08:59:02 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-08-12 08:59:02 +0000 |
commit | 43eb2bb6967ffd6d9b9fadfa606c177671c28261 (patch) | |
tree | 635eabb828234fd50167e8898221eeaa9dce1bea /gcc | |
parent | 4d7d2736587ecfb99b513645dda7460f9100f69c (diff) | |
download | gcc-43eb2bb6967ffd6d9b9fadfa606c177671c28261.zip gcc-43eb2bb6967ffd6d9b9fadfa606c177671c28261.tar.gz gcc-43eb2bb6967ffd6d9b9fadfa606c177671c28261.tar.bz2 |
[Ada] Plug small loophole in Discrete_Range_Check
This routine would not return if range checks are suppressed.
2019-08-12 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* exp_ch4.adb (Discrete_Range_Check): Return if checks are
suppressed.
From-SVN: r274282
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/exp_ch4.adb | 19 |
2 files changed, 23 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 315b4f6..df19f1b 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,10 @@ 2019-08-12 Eric Botcazou <ebotcazou@adacore.com> + * exp_ch4.adb (Discrete_Range_Check): Return if checks are + suppressed. + +2019-08-12 Eric Botcazou <ebotcazou@adacore.com> + * sem_res.adb: Add with & use clause for Sem_Mech and alphabetize. (Resolve_Actuals): Do not apply a scalar range check for the diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index e4dc06b..425c505 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -10969,7 +10969,9 @@ package body Exp_Ch4 is -- Discrete_Range_Check -- -------------------------- - -- Case of conversions to a discrete type + -- Case of conversions to a discrete type. We let Generate_Range_Check + -- do the heavy lifting, after converting a fixed-point operand to an + -- appropriate integer type. procedure Discrete_Range_Check is Expr : Node_Id; @@ -10984,6 +10986,21 @@ package body Exp_Ch4 is Expr := Expression (N); + -- Nothing to do if range checks suppressed + + if Range_Checks_Suppressed (Target_Type) then + return; + end if; + + -- Nothing to do if expression is an entity on which checks have been + -- suppressed. + + if Is_Entity_Name (Expr) + and then Range_Checks_Suppressed (Entity (Expr)) + then + return; + end if; + -- Before we do a range check, we have to deal with treating -- a fixed-point operand as an integer. The way we do this -- is simply to do an unchecked conversion to an appropriate |