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
This commit is contained in:
parent
adf8bb4f07
commit
940ff20cac
4 changed files with 36 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
|||
2013-01-06 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gcc-interface/decl.c (gnat_to_gnu_entity) <discrete_type>: Do not
|
||||
pack the field of the record type made for a misaligned type.
|
||||
|
||||
2013-01-06 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gcc-interface/decl.c (annotate_value) <COMPONENT_REF>: Be prepared
|
||||
|
@ -12,7 +17,7 @@
|
|||
* einfo.adb, atree.adb: Enlarge entities to make 63 more flags, 6 more
|
||||
fields.
|
||||
|
||||
2013-01-04 Joel Brobecker <brobecker@adacore.com brobecker>
|
||||
2013-01-04 Joel Brobecker <brobecker@adacore.com>
|
||||
|
||||
* gnat_ugn.texi: Fix typo.
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2013-01-06 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gnat.dg/alignment10.adb: New test.
|
||||
|
||||
2013-01-05 Steven G. Kargl <kargl@gcc.gnu.org>
|
||||
Mikael Morin <mikael@gcc.gnu.org>
|
||||
|
||||
|
|
20
gcc/testsuite/gnat.dg/alignment10.adb
Normal file
20
gcc/testsuite/gnat.dg/alignment10.adb
Normal file
|
@ -0,0 +1,20 @@
|
|||
-- { dg-do run }
|
||||
|
||||
procedure Alignment10 is
|
||||
|
||||
type Short_T is mod 2 ** 16;
|
||||
for Short_T'Size use 16;
|
||||
for Short_T'Alignment use 1;
|
||||
|
||||
subtype Short_Sub_T is Short_T range 1000 .. 1005;
|
||||
|
||||
A : aliased Short_T := 1000;
|
||||
B : Short_Sub_T;
|
||||
for B'Address use A'Address;
|
||||
pragma Import (Ada, B);
|
||||
|
||||
begin
|
||||
if B /= 1000 then
|
||||
raise Program_Error;
|
||||
end if;
|
||||
end;
|
Loading…
Add table
Reference in a new issue