[Ada] Fix range check on constrained array with expanded index name
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 22 Jun 2020 11:48:43 +0000 (13:48 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 15 Oct 2020 09:39:08 +0000 (05:39 -0400)
gcc/ada/

* sem_ch3.adb (Analyze_Subtype_Declaration): Recognize both
identifiers and expanded names; use high-level Is_Scalar_Type
instead of low-level membership test.

gcc/ada/sem_ch3.adb

index a5690d62e56cf214d5a7dc8409c0d88e1ebcb4cc..8581938d366ad02d4ef12a9bd50e4f4c4681ff84 100644 (file)
@@ -5829,8 +5829,8 @@ package body Sem_Ch3 is
                Target_Index := First_Index (Indic_Typ);
 
                while Present (Subt_Index) loop
-                  if ((Nkind (Subt_Index) = N_Identifier
-                        and then Ekind (Entity (Subt_Index)) in Scalar_Kind)
+                  if ((Nkind (Subt_Index) in N_Expanded_Name | N_Identifier
+                        and then Is_Scalar_Type (Entity (Subt_Index)))
                        or else Nkind (Subt_Index) = N_Subtype_Indication)
                     and then
                       Nkind (Scalar_Range (Etype (Subt_Index))) = N_Range