Fix ICE on nested packed variant record type
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 11 Sep 2020 09:14:49 +0000 (11:14 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Fri, 11 Sep 2020 09:14:49 +0000 (11:14 +0200)
commitef4ab841d94a4f6ec975c9653c69faeeb85c78e8
tree80865fa17b4278a87fcb9baf63c29ddc36e2b443
parentb5ffd55a61df01d226f3fa4260f108bda8565c16
Fix ICE on nested packed variant record type

This is a regression present on the mainline and 10 branch: the compiler
aborts on code accessing a component of a packed record type whose type
is a packed discriminated record type with variant part.

gcc/ada/ChangeLog:
* gcc-interface/utils.c (type_has_variable_size): New function.
(create_field_decl): In the packed case, also force byte alignment
when the type of the field has variable size.

gcc/testsuite/ChangeLog:
* gnat.dg/pack27.adb: New test.
* gnat.dg/pack27_pkg.ads: New helper.
gcc/ada/gcc-interface/utils.c
gcc/testsuite/gnat.dg/pack27.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/pack27_pkg.ads [new file with mode: 0644]