public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/autopar_devel] [Ada] Improved support for aspect alignment in CCG
@ 2020-08-22 21:51 Giuliano Belinassi
0 siblings, 0 replies; only message in thread
From: Giuliano Belinassi @ 2020-08-22 21:51 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:7c2a3baf2c20906e0c4f800b322c850a2719d724
commit 7c2a3baf2c20906e0c4f800b322c850a2719d724
Author: Javier Miranda <miranda@adacore.com>
Date: Thu Dec 26 15:29:24 2019 -0500
[Ada] Improved support for aspect alignment in CCG
2020-06-02 Javier Miranda <miranda@adacore.com>
gcc/ada/
* sem_ch3.adb (Analyze_Object_Declaration): Set attribute
Expansion_Delayed on aggregates that initialize an object that
has aspect alignment or address clause. Done to allow ther
initialization by means of multiple assignments.
* exp_ch3.adb (Expand_N_Object_Declaration): Resolve delayed
aggregates. This patch complements the patch applied to
sem_ch3.adb
Diff:
---
gcc/ada/exp_ch3.adb | 8 ++++++--
gcc/ada/sem_ch3.adb | 6 +++++-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index 15d468be6c1..cfc01f50ff6 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 c57be77a46c..1479e34f765 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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-08-22 21:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-22 21:51 [gcc/devel/autopar_devel] [Ada] Improved support for aspect alignment in CCG Giuliano Belinassi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).