ada: Fix issue with indefinite vector of overaligned unconstrained array
commit4d011701c074cac9bab7edfcf07c1868f0472177
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 20 Oct 2023 08:26:23 +0000 (20 10:26 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 21 Nov 2023 09:57:43 +0000 (21 10:57 +0100)
tree0a05cc16cafb2598cf180bf1b2cdf47d88846099
parent1f61f81d6ce2fe9c0ee0d833d216b848e0ad0ae4
ada: Fix issue with indefinite vector of overaligned unconstrained array

The problem is that the aligning machinery is not consistently triggered,
depending on whether a constrained view or the nominal unconstrained view
of the element type is used to perform the allocations and deallocations.

gcc/ada/

* gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Array_Subtype>: Put
the alignment directly on the type in the constrained case too.
* gcc-interface/utils.cc (maybe_pad_type): For an array type, take
the alignment of the element type as the original alignment.
gcc/ada/gcc-interface/decl.cc
gcc/ada/gcc-interface/utils.cc