[multiple changes]

2014-08-04  Ed Schonberg  <schonberg@adacore.com>

	* sem_util.adb (Is_Potentially_Unevaluated): If the original
	node of a parent node in the tree is a short-circuit operation,
	the node is potentially unevaluated.

2014-08-04  Robert Dewar  <dewar@adacore.com>

	* sem_res.adb (Resolve_Type_Conversion): Set Do_Range_Check on
	conversion from a real type to an integer type.

From-SVN: r213538
This commit is contained in:
Arnaud Charlet 2014-08-04 10:07:57 +02:00
parent ce5ba43a4e
commit 98bf4cf497
3 changed files with 38 additions and 5 deletions

View File

@ -1,3 +1,14 @@
2014-08-04 Ed Schonberg <schonberg@adacore.com>
* sem_util.adb (Is_Potentially_Unevaluated): If the original
node of a parent node in the tree is a short-circuit operation,
the node is potentially unevaluated.
2014-08-04 Robert Dewar <dewar@adacore.com>
* sem_res.adb (Resolve_Type_Conversion): Set Do_Range_Check on
conversion from a real type to an integer type.
2014-08-04 Yannick Moy <moy@adacore.com>
* sem_aggr.adb, sem_ch3.adb, sem_ch5.adb, sem_ch7.adb, sem_ch9.adb,

View File

@ -10322,11 +10322,11 @@ package body Sem_Res is
-- odd subtype coming from the bounds).
if (Is_Entity_Name (Orig_N)
and then
(Etype (Entity (Orig_N)) = Orig_T
or else
(Ekind (Entity (Orig_N)) = E_Loop_Parameter
and then Covers (Orig_T, Etype (Entity (Orig_N))))))
and then
(Etype (Entity (Orig_N)) = Orig_T
or else
(Ekind (Entity (Orig_N)) = E_Loop_Parameter
and then Covers (Orig_T, Etype (Entity (Orig_N))))))
-- If not an entity, then type of expression must match
@ -10504,6 +10504,17 @@ package body Sem_Res is
Apply_Predicate_Check (N, Target_Typ);
end if;
end if;
-- If at this stage we have a real to integer conversion, make sure
-- that the Do_Range_Check flag is set, because such conversions in
-- general need a range check.
if Nkind (N) = N_Type_Conversion
and then Is_Integer_Type (Target_Typ)
and then Is_Real_Type (Operand_Typ)
then
Set_Do_Range_Check (Operand);
end if;
end Resolve_Type_Conversion;
----------------------

View File

@ -11146,6 +11146,17 @@ package body Sem_Util is
begin
Expr := N;
Par := Parent (N);
-- A postcondition whose expression is a short-circuit is broken down
-- into individual aspects for better exception reporting. The original
-- short-circuit expression is rewritten as the second operand, and an
-- occurrence of 'Old in that operand is potentially unevaluated.
-- See Sem_ch13.adb for details of this transformation.
if Nkind (Original_Node (Par)) = N_And_Then then
return True;
end if;
while not Nkind_In (Par, N_If_Expression,
N_Case_Expression,
N_And_Then,