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

commit r13-9148-gfbad5c84458324c82f848d35fffa02cb5a412270
Author: Eric Botcazou <ebotca...@adacore.com>
Date:   Wed Sep 11 19:53:12 2024 +0200

    ada: Fix internal error on bit-packed array type with Volatile_Full_Access
    
    The problem occurs when the component type is a record type with default
    values for the initialization procedure of the (base) array type, because
    the compiler is trying to generate a full access for a parameter of the
    base array type, which does not make sense.
    
    gcc/ada/ChangeLog:
    
            PR ada/116551
            * gcc-interface/trans.cc (node_is_atomic) <N_Identifier>: Return
            false if the type of the entity is an unconstrained array type.
            (node_is_volatile_full_access) <N_Identifier>: Likewise.

Diff:
---
 gcc/ada/gcc-interface/trans.cc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc
index 0c7fde754ea6..d54e7118593f 100644
--- a/gcc/ada/gcc-interface/trans.cc
+++ b/gcc/ada/gcc-interface/trans.cc
@@ -4193,7 +4193,10 @@ node_is_atomic (Node_Id gnat_node)
       if (!Is_Object (gnat_entity))
        break;
       return Is_Atomic (gnat_entity)
+            /* Disregard the flag on unconstrained arrays or simple constants
+               since we cannot or need not generate an atomic access.  */
             || (Is_Atomic (Etype (gnat_entity))
+                && Ekind (Etype (gnat_entity)) != E_Array_Type
                 && !simple_constant_p (gnat_entity));
 
     case N_Selected_Component:
@@ -4233,7 +4236,10 @@ node_is_volatile_full_access (Node_Id gnat_node)
       if (!Is_Object (gnat_entity))
        break;
       return Is_Volatile_Full_Access (gnat_entity)
+            /* Disregard the flag on unconstrained arrays or simple constants
+               since we cannot or need not generate a full access.  */
             || (Is_Volatile_Full_Access (Etype (gnat_entity))
+                && Ekind (Etype (gnat_entity)) != E_Array_Type
                 && !simple_constant_p (gnat_entity));
 
     case N_Selected_Component:

Reply via email to