summaryrefslogtreecommitdiff
path: root/gcc/ada/exp_aggr.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2008-04-08 06:49:26 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2008-04-08 06:49:26 +0000
commit5a6d2768b045ffc8ad5d0b0bd18127f059063a12 (patch)
tree36d245f088a115a8d65e90355e6a66a55c481816 /gcc/ada/exp_aggr.adb
parent5d3d6667984c6a6bed163844679385b91ed807d8 (diff)
downloadgcc-5a6d2768b045ffc8ad5d0b0bd18127f059063a12.tar.gz
2008-04-08 Ed Schonberg <schonberg@adacore.com>
* exp_aggr.adb (Static_Array_Aggregate): Use Max_Aggr_Size to determine whether an array aggregate with static bounds and scalar components should be expanded into a static constant. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@134025 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_aggr.adb')
-rw-r--r--gcc/ada/exp_aggr.adb18
1 files changed, 9 insertions, 9 deletions
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index c334150b84a..c815369e821 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -300,7 +300,7 @@ package body Exp_Aggr is
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.
@@ -1170,9 +1170,9 @@ package body Exp_Aggr is
-- 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)
@@ -1677,10 +1677,6 @@ package body Exp_Aggr is
-- Build_Record_Aggr_Code --
----------------------------
- ----------------------------
- -- Build_Record_Aggr_Code --
- ----------------------------
-
function Build_Record_Aggr_Code
(N : Node_Id;
Typ : Entity_Id;
@@ -6350,7 +6346,8 @@ package body Exp_Aggr is
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)
@@ -6364,6 +6361,9 @@ package body Exp_Aggr is
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