decl.c (gnat_to_gnu_entity): Adjust call to components_to_record.
authorEric Botcazou <ebotcazou@adacore.com>
Sun, 20 Nov 2011 10:03:11 +0000 (10:03 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Sun, 20 Nov 2011 10:03:11 +0000 (10:03 +0000)
commitb1a785fb5e5ada5ffb07640bb8fe0d15f3bddb68
tree8c3bf3eed49ecfca419ebe789652ad0382b632ed
parent4076011132f7483c1cceacb8bfb2d0536e1b980c
decl.c (gnat_to_gnu_entity): Adjust call to components_to_record.

* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: Adjust
call to components_to_record.
(components_to_record): Add FIRST_FREE_POS parameter.  For the variant
part, reuse enclosing union even if there is a representation clause
on the Unchecked_Union.  If there is a variant part, compute the new
first free position, if any.  Adjust call to self.  Use a single field
directly only if it hasn't got a representation clause or is placed at
offset zero.  Create the variant part at offset 0 if all the fields
down to this level have a rep clause.  Do not chain the variant part
immediately and adjust downstream.
Do not test ALL_REP before moving the fields without rep clause to the
previous level.  Call create_rep_part to create the REP part and force
a minimum size on it if necessary.  Do not chain it immediately.
Create a fake REP part if there are fields without rep clause that need
to be laid out starting from FIRST_FREE_POS.
At the end, chain the REP part and then the variant part.
(create_rep_part): New function.
(get_rep_part): Minor tweak.
* gcc-interface/utils.c (tree_code_for_record_type): Minor tweak.

From-SVN: r181526
gcc/ada/ChangeLog
gcc/ada/gcc-interface/decl.c
gcc/ada/gcc-interface/utils.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/discr32.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/discr32_pkg.ads [new file with mode: 0644]