* [Ada] Fix internal alignment issue
@ 2015-06-01 8:04 Eric Botcazou
0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2015-06-01 8:04 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 525 bytes --]
This fixes an old alignment issue with the _Parent field created by gigi for
extension of tagged types: when the record type has a representation clause,
the field is not correctly aligned, which leads to further issues downhill.
Tested on x86_64-suse-linux, applied on the mainline.
2015-06-01 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: If the
record has a parent field and a representation clause, make sure that
it is properly aligned.
--
Eric Botcazou
[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 846 bytes --]
Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c (revision 223912)
+++ gcc-interface/decl.c (working copy)
@@ -3019,6 +3019,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
else
gnu_parent = gnat_to_gnu_type (gnat_parent);
+ /* The parent field needs strict alignment so, if it is to
+ be created with a component clause below, then we need
+ to apply the same adjustment as in gnat_to_gnu_field. */
+ if (has_rep && TYPE_ALIGN (gnu_type) < TYPE_ALIGN (gnu_parent))
+ TYPE_ALIGN (gnu_type) = TYPE_ALIGN (gnu_parent);
+
/* Finally we fix up both kinds of twisted COMPONENT_REF we have
initially built. The discriminants must reference the fields
of the parent subtype and not those of its base type for the
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-06-01 8:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-01 8:04 [Ada] Fix internal alignment issue Eric Botcazou
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).