[gcc r10-10117] [Ada] Fix bogus error for bit-packed array with volatile component

Eric Botcazou ebotcazou@gcc.gnu.org
Tue Sep 14 07:49:15 GMT 2021


https://gcc.gnu.org/g:2a4b29cdfd06346f7219bc5d9c21265dd354509f

commit r10-10117-g2a4b29cdfd06346f7219bc5d9c21265dd354509f
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Tue Aug 4 15:08:56 2020 +0200

    [Ada] Fix bogus error for bit-packed array with volatile component
    
    gcc/ada/
    
            * freeze.adb (Check_Strict_Alignment): Do not set the flag for
            a bit-packed array type, even if it is a by-reference type.

Diff:
---
 gcc/ada/freeze.adb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 0312ca704aa..458e1b4d3c2 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -1610,7 +1610,10 @@ package body Freeze is
       Comp  : Entity_Id;
 
    begin
-      if Is_By_Reference_Type (E) then
+      --  Bit-packed array types do not require strict alignment, even if they
+      --  are by-reference types, because they are accessed in a special way.
+
+      if Is_By_Reference_Type (E) and then not Is_Bit_Packed_Array (E) then
          Set_Strict_Alignment (E);
 
       elsif Is_Array_Type (E) then


More information about the Gcc-cvs mailing list