when Attribute_First =>
Set_Bounds;
+ -- In GNATprove mode we only fold array attributes when prefix is
+ -- static (because that's required by the Ada rules) or at least can
+ -- be evaluated without checks (because GNATprove would miss them).
+
+ if GNATprove_Mode
+ and then
+ not (Static
+ or else (Is_Entity_Name (P) and then Is_Type (Entity (P)))
+ or else Statically_Names_Object (P)
+ or else Ekind (P_Type) = E_String_Literal_Subtype)
+ then
+ return;
+ end if;
+
if Compile_Time_Known_Value (Lo_Bound) then
if Is_Real_Type (P_Type) then
Fold_Ureal (N, Expr_Value_R (Lo_Bound), Static);
when Attribute_Last =>
Set_Bounds;
+ -- In GNATprove mode we only fold array attributes when prefix is
+ -- static (because that's required by the Ada rules) or at least can
+ -- be evaluated without checks (because GNATprove would miss them).
+
+ if GNATprove_Mode
+ and then
+ not (Static
+ or else (Is_Entity_Name (P) and then Is_Type (Entity (P)))
+ or else Statically_Names_Object (P)
+ or else Ekind (P_Type) = E_String_Literal_Subtype)
+ then
+ return;
+ end if;
+
if Compile_Time_Known_Value (Hi_Bound) then
if Is_Real_Type (P_Type) then
Fold_Ureal (N, Expr_Value_R (Hi_Bound), Static);
Set_Bounds;
+ -- In GNATprove mode we only fold array attributes when prefix is
+ -- static (because that's required by the Ada rules) or at least can
+ -- be evaluated without checks (because GNATprove would miss them).
+
+ if GNATprove_Mode
+ and then
+ not (Static
+ or else (Is_Entity_Name (P) and then Is_Type (Entity (P)))
+ or else Statically_Names_Object (P)
+ or else Ekind (P_Type) = E_String_Literal_Subtype)
+ then
+ return;
+ end if;
+
-- For two compile time values, we can compute length
if Compile_Time_Known_Value (Lo_Bound)