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