Hiv : Uint;
-- The following constant determines the maximum size of an
- -- aggregate produced by converting named to positional
+ -- array aggregate produced by converting named to positional
-- notation (e.g. from others clauses). This avoids running
-- away with attempts to convert huge aggregates, which hit
-- memory limits in the backend.
-- If the component is itself an array of controlled types, whose
-- value is given by a sub-aggregate, then the attach calls have
-- been generated when individual subcomponent are assigned, and
- -- and must not be done again to prevent malformed finalization
- -- chains (see comments above, concerning the creation of a block
- -- to hold inner finalization actions).
+ -- must not be done again to prevent malformed finalization chains
+ -- (see comments above, concerning the creation of a block to hold
+ -- inner finalization actions).
if Present (Comp_Type)
and then Controlled_Type (Comp_Type)
-- Build_Record_Aggr_Code --
----------------------------
- ----------------------------
- -- Build_Record_Aggr_Code --
- ----------------------------
-
function Build_Record_Aggr_Code
(N : Node_Id;
Typ : Entity_Id;
else
-- The aggregate is static if all components are literals, or
-- else all its components are static aggregates for the
- -- component type.
+ -- component type. We also limit the size of a static aggregate
+ -- to prevent runaway static expressions.
if Is_Array_Type (Comp_Type)
or else Is_Record_Type (Comp_Type)
elsif Nkind (Expression (Expr)) /= N_Integer_Literal then
return False;
+
+ elsif not Aggr_Size_OK (Typ) then
+ return False;
end if;
-- Create a positional aggregate with the right number of