-- fully constructed, since it simply indicates the last state.
-- Thus this flag has no meaning to the backend.
+-- Is_Large_Unconstrained_Definite
+-- Defined in record types. Used to detect types with default
+-- discriminant values that have exaggerated sizes and emit warnings
+-- about them.
+
-- Is_Limited_Composite
-- Defined in all entities. Set for composite types that have a limited
-- component. Used to enforce the rule that operations on the composite
Is_Known_Non_Null,
Is_Known_Null,
Is_Known_Valid,
+ Is_Large_Unconstrained_Definite,
Is_Limited_Composite,
Is_Limited_Interface,
Is_Limited_Record,
Sm (No_Reordering, Flag, Impl_Base_Type_Only),
Sm (Parent_Subtype, Node_Id, Base_Type_Only),
Sm (Reverse_Bit_Order, Flag, Base_Type_Only),
- Sm (Underlying_Record_View, Node_Id)));
+ Sm (Underlying_Record_View, Node_Id),
+ Sm (Is_Large_Unconstrained_Definite, Flag, Impl_Base_Type_Only)));
Cc (E_Record_Subtype, Aggregate_Kind,
-- A record subtype, created by a record subtype declaration
end;
end if;
end if;
+
+ if Ekind (T) = E_Record_Type
+ and then Is_Large_Unconstrained_Definite (T)
+ and then not Is_Limited_Type (T)
+ then
+ Error_Msg_N ("??creation of & object may raise Storage_Error!", T);
+ end if;
end Analyze_Full_Type_Declaration;
----------------------------------
goto No_Danger;
end if;
- -- If the enclosing type is limited, we allocate only the
- -- default value, not the maximum, and there is no need for
- -- a warning.
-
- if Is_Limited_Type (Scope (Disc)) then
- goto No_Danger;
- end if;
-
-- Check that it is the high bound
if N /= High_Bound (PN)
goto No_Danger;
end if;
- -- Warn about the danger
-
- Error_Msg_N
- ("??creation of & object may raise Storage_Error!",
- Scope (Disc));
+ if Ekind (Scope (Disc)) = E_Record_Type then
+ Set_Is_Large_Unconstrained_Definite (Scope (Disc));
+ end if;
<<No_Danger>>
null;