public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6393] [Ada] Adjust the alignment to the size for bit-packed arrays
@ 2022-01-10  9:40 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-01-10  9:40 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:a283cf62e45e080f4f9294573b04b9a28cd72ee8

commit r12-6393-ga283cf62e45e080f4f9294573b04b9a28cd72ee8
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Thu Dec 30 20:06:50 2021 +0100

    [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.

Diff:
---
 gcc/ada/exp_pakd.adb | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/gcc/ada/exp_pakd.adb b/gcc/ada/exp_pakd.adb
index 78093f8529b..abb20881906 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-10  9:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-10  9:40 [gcc r12-6393] [Ada] Adjust the alignment to the size for bit-packed arrays Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).