diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2021-12-30 20:06:50 +0100 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2022-01-10 09:38:44 +0000 |
commit | a283cf62e45e080f4f9294573b04b9a28cd72ee8 (patch) | |
tree | c1cc667061c7214aaf8cf20661a332eac213df1e /gcc/ada | |
parent | ad85af8e5a6f2e7c3482b23c2e2153228889635e (diff) | |
download | gcc-a283cf62e45e080f4f9294573b04b9a28cd72ee8.zip gcc-a283cf62e45e080f4f9294573b04b9a28cd72ee8.tar.gz gcc-a283cf62e45e080f4f9294573b04b9a28cd72ee8.tar.bz2 |
[Ada] Adjust the alignment to the size for bit-packed arrays
gcc/ada/
* exp_pakd.adb (Install_PAT): If the PAT is a scalar type, apply
the canonical adjustment to its alignment.
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/exp_pakd.adb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/ada/exp_pakd.adb b/gcc/ada/exp_pakd.adb index 78093f8..abb2088 100644 --- a/gcc/ada/exp_pakd.adb +++ b/gcc/ada/exp_pakd.adb @@ -573,6 +573,19 @@ package body Exp_Pakd is end if; end if; + -- In the case of a modular type, make sure the alignment is + -- consistent with the Esize. + + if Is_Scalar_Type (PAT) then + while Alignment (PAT) * System_Storage_Unit < Esize (PAT) + and then Alignment (PAT) < Maximum_Alignment + loop + Set_Alignment (PAT, 2 * Alignment (PAT)); + end loop; + end if; + + -- Then, in all cases, make sure the opposite is also true + Adjust_Esize_Alignment (PAT); -- Set remaining fields of packed array type |