decl.c (components_to_record): Add special case for single field with representation clause at offset 0.
* gcc-interface/decl.c (components_to_record): Add special case for single field with representation clause at offset 0. From-SVN: r234494
This commit is contained in:
parent
5f7f4dffdc
commit
a1799e5ef7
@ -1,3 +1,8 @@
|
||||
2016-03-27 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gcc-interface/decl.c (components_to_record): Add special case for
|
||||
single field with representation clause at offset 0.
|
||||
|
||||
2016-03-16 Svante Signell <svante.signell@gmail.com>
|
||||
|
||||
* gcc-interface/Makefile.in: Add support for x86 GNU/Hurd.
|
||||
|
@ -7606,6 +7606,23 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
|
||||
if (p_gnu_rep_list && gnu_rep_list)
|
||||
*p_gnu_rep_list = chainon (*p_gnu_rep_list, gnu_rep_list);
|
||||
|
||||
/* If only one field has a rep clause and it starts at 0, put back the field
|
||||
at the head of the regular field list. This will avoid creating a useless
|
||||
REP part below and deal with the annoying case of an extension of a record
|
||||
with variable size and rep clause, for which the _Parent field is forced
|
||||
at offset 0 and has variable size, which we do not support below. */
|
||||
else if (gnu_rep_list
|
||||
&& !DECL_CHAIN (gnu_rep_list)
|
||||
&& !variants_have_rep
|
||||
&& first_free_pos
|
||||
&& integer_zerop (first_free_pos)
|
||||
&& integer_zerop (bit_position (gnu_rep_list)))
|
||||
{
|
||||
DECL_CHAIN (gnu_rep_list) = gnu_field_list;
|
||||
gnu_field_list = gnu_rep_list;
|
||||
gnu_rep_list = NULL_TREE;
|
||||
}
|
||||
|
||||
/* Otherwise, sort the fields by bit position and put them into their own
|
||||
record, before the others, if we also have fields without rep clause. */
|
||||
else if (gnu_rep_list)
|
||||
|
@ -1,3 +1,7 @@
|
||||
2016-03-27 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gnat.dg/specs/double_record_extension3.ads: New test.
|
||||
|
||||
2016-03-25 Richard Henderson <rth@redhat.com>
|
||||
|
||||
PR target/70120
|
||||
|
22
gcc/testsuite/gnat.dg/specs/double_record_extension3.ads
Normal file
22
gcc/testsuite/gnat.dg/specs/double_record_extension3.ads
Normal file
@ -0,0 +1,22 @@
|
||||
-- { dg-do compile }
|
||||
|
||||
package Double_Record_Extension3 is
|
||||
|
||||
type Rec1 is tagged record
|
||||
Id : Integer;
|
||||
end record;
|
||||
|
||||
for Rec1 use record
|
||||
Id at 8 range 0 .. 31;
|
||||
end record;
|
||||
|
||||
type Rec2 (Size : Integer) is new Rec1 with record
|
||||
Data : String (1 .. Size);
|
||||
end record;
|
||||
|
||||
type Rec3 is new Rec2 (Size => 128) with record
|
||||
Valid : Boolean;
|
||||
end record;
|
||||
|
||||
end Double_Record_Extension3;
|
||||
|
Loading…
Reference in New Issue
Block a user