For array subtypes, return the extended types corresponding to the array
type.

gcc/ada/ChangeLog:

        * gcc-interface/decl.cc (get_extended_unconstrained_array): Handle
        array subtype.

Co-authored-by: Éric Botcazou <[email protected]>

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/gcc-interface/decl.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc
index 9ade3fd8c4e..7ebd4321195 100644
--- a/gcc/ada/gcc-interface/decl.cc
+++ b/gcc/ada/gcc-interface/decl.cc
@@ -5310,6 +5310,10 @@ get_extended_unconstrained_array (Entity_Id gnat_entity, 
tree gnu_type)
   gcc_assert (Is_Array_Type (gnat_entity)
              && TREE_CODE (gnu_type) == UNCONSTRAINED_ARRAY_TYPE);
 
+
+  if (Ekind (gnat_entity) == E_Array_Subtype)
+    return get_extended_unconstrained_array (Etype (gnat_entity), gnu_type);
+
   tree gnu_extended_type = TYPE_EXTENDED_UNCONSTRAINED_ARRAY (gnu_type);
 
   /* Building the extended type is achieved by translating the array type
-- 
2.43.0

Reply via email to