aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/decl.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2019-10-11 09:09:40 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2019-10-11 09:09:40 +0000
commit75a582cd9f98b4cdea2eb8e961d53dc8d30fd462 (patch)
tree0652b424a034b022a2124d283bc526b85c44ee01 /gcc/ada/gcc-interface/decl.c
parent76dcb70dab490c5dbabaf1b982a1650da2a341cf (diff)
downloadgcc-75a582cd9f98b4cdea2eb8e961d53dc8d30fd462.zip
gcc-75a582cd9f98b4cdea2eb8e961d53dc8d30fd462.tar.gz
gcc-75a582cd9f98b4cdea2eb8e961d53dc8d30fd462.tar.bz2
decl.c (gnat_to_gnu_field): Adjust again the packing for a field without strict alignment and with an...
* gcc-interface/decl.c (gnat_to_gnu_field): Adjust again the packing for a field without strict alignment and with an oversized clause. From-SVN: r276873
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r--gcc/ada/gcc-interface/decl.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 2c5f573..b3f8d58 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -7229,10 +7229,17 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed,
&& INTEGRAL_TYPE_P (TREE_TYPE (TYPE_FIELDS (gnu_field_type))))
gnu_field_type = TREE_TYPE (TYPE_FIELDS (gnu_field_type));
+ orig_field_type = gnu_field_type;
gnu_field_type
= make_type_from_size (gnu_field_type, gnu_size,
Has_Biased_Representation (gnat_field));
+ /* If the type has been extended, we may need to cap the alignment. */
+ if (!needs_strict_alignment
+ && gnu_field_type != orig_field_type
+ && tree_int_cst_lt (TYPE_SIZE (orig_field_type), gnu_size))
+ packed = adjust_packed (gnu_field_type, gnu_record_type, packed);
+
orig_field_type = gnu_field_type;
gnu_field_type = maybe_pad_type (gnu_field_type, gnu_size, 0, gnat_field,
false, false, definition, true);