]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix internal error on bit-packed array type with Volatile_Full_Access
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 11 Sep 2024 17:53:12 +0000 (19:53 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Fri, 25 Oct 2024 11:18:22 +0000 (13:18 +0200)
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.

gcc/ada/gcc-interface/trans.cc

index 8c7ffbf56877352dd022e0144cc1060b9b97f258..86183e2ba3dd6436b732dbc8a0649080b13f7f1b 100644 (file)
@@ -4230,7 +4230,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:
@@ -4270,7 +4273,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: