aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r--gcc/ada/gcc-interface/decl.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index a77ca6634e0..d3f30897116 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -7381,6 +7381,25 @@ 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);
+ /* Deal with the annoying case of an extension of a record with variable size
+ and partial rep clause, for which the _Parent field is forced at offset 0
+ and has variable size, which we do not support below. Note that we cannot
+ do it if the field has fixed size because we rely on the presence of the
+ REP part built below to trigger the reordering of the fields in a derived
+ record type when all the fields have a fixed position. */
+ else if (gnu_rep_list
+ && !DECL_CHAIN (gnu_rep_list)
+ && TREE_CODE (DECL_SIZE (gnu_rep_list)) != INTEGER_CST
+ && !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)