From: Eric Botcazou Date: Mon, 1 Jun 2015 08:04:16 +0000 (+0000) Subject: decl.c (gnat_to_gnu_entity): If the record has a parent field and a representation... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8c41a1c8f01a07d8fd2f5df57d90879969090618;p=gcc.git 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) : If the record has a parent field and a representation clause, make sure that it is properly aligned. From-SVN: r223915 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 2c2b237608e..e105d51edba 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2015-06-01 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity) : If the + record has a parent field and a representation clause, make sure that + it is properly aligned. + 2015-06-01 Eric Botcazou * gcc-interface/trans.c (lvalue_required_p) : Deal diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 966bf8e1309..21f5f701b97 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