Fix regression with partial rep clause on variant record type
commite8c87bc07b5c98101b47caaee84650cd8abdfa5f
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 3 Feb 2021 10:38:04 +0000 (3 11:38 +0100)
committerEric Botcazou <ebotcazou@adacore.com>
Wed, 3 Feb 2021 10:38:04 +0000 (3 11:38 +0100)
tree5badee4ab77820205d39dd2344f571f358af2fe2
parentfc130ab54fd9a254f07426f9c180c367b039d7f9
Fix regression with partial rep clause on variant record type

It can yield an incorrect layout when there is a partial representation
clause on a discriminated record type with a variant part.

gcc/ada/
* gcc-interface/decl.c (components_to_record): If the first component
with rep clause is the _Parent field with variable size, temporarily
set it aside when computing the internal layout of the REP part again.
* gcc-interface/utils.c (finish_record_type): Revert to taking the
maximum when merging sizes for all record types with rep clause.
(merge_sizes): Put SPECIAL parameter last and adjust recursive calls.
gcc/ada/gcc-interface/decl.c
gcc/ada/gcc-interface/utils.c