+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
-- 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;
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