Commit 43eb2bb6 by Eric Botcazou Committed by Pierre-Marie de Rodat

[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
parent 4d7d2736
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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment