aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/exp_ch3.adb8
-rw-r--r--gcc/ada/sem_ch3.adb6
2 files changed, 11 insertions, 3 deletions
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index 15d468b..cfc01f5 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -6610,9 +6610,13 @@ package body Exp_Ch3 is
-- An aggregate that must be built in place is not resolved and
-- expanded until the enclosing construct is expanded. This will
-- happen when the aggregate is limited and the declared object
- -- has a following address clause.
+ -- has a following address clause; it happens also when generating
+ -- C code for an aggregate that has an alignment or address clause
+ -- (see Analyze_Object_Declaration).
- if Is_Limited_Type (Typ) and then not Analyzed (Expr) then
+ if (Is_Limited_Type (Typ) or else Modify_Tree_For_C)
+ and then not Analyzed (Expr)
+ then
Resolve (Expr, Typ);
end if;
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index c57be77..1479e34 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -4318,7 +4318,11 @@ package body Sem_Ch3 is
-- If the aggregate is limited it will be built in place, and its
-- expansion is deferred until the object declaration is expanded.
- if Is_Limited_Type (T) then
+ -- This is also required when generating C code to ensure that an
+ -- object with an alignment or address clause can be initialized
+ -- by means of component by component assignments.
+
+ if Is_Limited_Type (T) or else Modify_Tree_For_C then
Set_Expansion_Delayed (E);
end if;