diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2016-03-27 09:57:36 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2016-03-27 09:57:36 +0000 |
commit | a1799e5ef7a4aaae3015a8ef8a5e49d91a1c3775 (patch) | |
tree | 3433f260719b88f30ce9afb1f69894d9264701d5 /gcc/ada/gcc-interface/decl.c | |
parent | 5f7f4dffdc27d4252b49605f162ddd1c7f6f69e4 (diff) | |
download | gcc-a1799e5ef7a4aaae3015a8ef8a5e49d91a1c3775.zip gcc-a1799e5ef7a4aaae3015a8ef8a5e49d91a1c3775.tar.gz gcc-a1799e5ef7a4aaae3015a8ef8a5e49d91a1c3775.tar.bz2 |
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
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 4b0ce28..ad84528 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -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) |