aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/decl.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2013-01-06 11:58:36 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2013-01-06 11:58:36 +0000
commit940ff20cacc289327c63f9e51bf176b7935a8a08 (patch)
treecf02d15bdfda08e9a1039a888fab5cbfc2c6a4be /gcc/ada/gcc-interface/decl.c
parentadf8bb4f07f6f05144db43faf21237dff80f64fb (diff)
downloadgcc-940ff20cacc289327c63f9e51bf176b7935a8a08.zip
gcc-940ff20cacc289327c63f9e51bf176b7935a8a08.tar.gz
gcc-940ff20cacc289327c63f9e51bf176b7935a8a08.tar.bz2
decl.c (gnat_to_gnu_entity): Do not pack the field of the record type made for a misaligned type.
* gcc-interface/decl.c (gnat_to_gnu_entity) <discrete_type>: Do not pack the field of the record type made for a misaligned type. From-SVN: r194942
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r--gcc/ada/gcc-interface/decl.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index f7db364..f312c7d 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -1887,8 +1887,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
}
/* If the type we are dealing with has got a smaller alignment than the
- natural one, we need to wrap it up in a record type and under-align
- the latter. We reuse the padding machinery for this purpose. */
+ natural one, we need to wrap it up in a record type and misalign the
+ latter; we reuse the padding machinery for this purpose. Note that,
+ even if the record type is marked as packed because of misalignment,
+ we don't pack the field so as to give it the size of the type. */
else if (align > 0)
{
tree gnu_field_type, gnu_field;
@@ -1918,7 +1920,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
a bitfield. */
gnu_field
= create_field_decl (get_identifier ("F"), gnu_field_type,
- gnu_type, NULL_TREE, bitsize_zero_node, 1, 0);
+ gnu_type, TYPE_SIZE (gnu_field_type),
+ bitsize_zero_node, 0, 0);
finish_record_type (gnu_type, gnu_field, 2, debug_info_p);
compute_record_mode (gnu_type);