-- for floating-point types. But the additional less precise tests below
-- catch these cases.
+ -- Under GNATProve mode, when the type of the expression is Universal
+ -- Integer we cannot determine if the expression is in the range of the
+ -- target type. Required because, Universal_Integer is implemented as a
+ -- 128-bit type but, in theory, its values may be out of range for
+ -- 128-bit target types.
+
-- Note: skip this if we are given a source_typ, since the point of
-- supplying a Source_Typ is to stop us looking at the expression.
-- We could sharpen this test to be out parameters only ???
if Is_Discrete_Type (Target_Typ)
and then not Is_Unconstrained_Subscr_Ref
and then No (Source_Typ)
+ and then not (Etype (Expr) = Universal_Integer
+ and then GNATprove_Mode)
then
declare
Thi : constant Node_Id := Type_High_Bound (Target_Typ);
then
return False;
+ -- Under GNATprove mode, do not consider T2 in the range of Universal
+ -- Integer (since theoretically they are not); required because
+ -- Universal_Integer is implemented as a 128-bits type.
+
+ elsif GNATprove_Mode
+ and then T1 = Universal_Integer
+ then
+ return False;
+
else
L1 := Type_Low_Bound (T1);
H1 := Type_High_Bound (T1);
elsif Is_Universal_Numeric_Type (Typ) then
return In_Range;
+ -- Under GNATprove mode, Universal type expressions are not in range
+ -- of subtype Typ.
+
+ elsif GNATprove_Mode
+ and then Is_Universal_Numeric_Type (Etype (N))
+ then
+ return Unknown;
+
-- Never known if not scalar type. Don't know if this can actually
-- happen, but our spec allows it, so we must check.