aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/decl.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2015-06-01 08:04:16 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2015-06-01 08:04:16 +0000
commit8c41a1c8f01a07d8fd2f5df57d90879969090618 (patch)
tree75050d1ee95526b3f9442f658186a13f77e76384 /gcc/ada/gcc-interface/decl.c
parent44eff886de1ade42076ad8168f76a28886fdeaa8 (diff)
downloadgcc-8c41a1c8f01a07d8fd2f5df57d90879969090618.zip
gcc-8c41a1c8f01a07d8fd2f5df57d90879969090618.tar.gz
gcc-8c41a1c8f01a07d8fd2f5df57d90879969090618.tar.bz2
decl.c (gnat_to_gnu_entity): If the record has a parent field and a representation clause...
* 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. From-SVN: r223915
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r--gcc/ada/gcc-interface/decl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 966bf8e..21f5f70 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -3019,6 +3019,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
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