* [Ada] Fix range check on constrained array with expanded index name
@ 2020-10-15 9:40 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2020-10-15 9:40 UTC (permalink / raw)
To: gcc-patches; +Cc: Piotr Trojanek
[-- Attachment #1: Type: text/plain, Size: 305 bytes --]
When detecting a type name we must look for both identifiers and
expanded names.
Tested on x86_64-pc-linux-gnu, committed on trunk
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.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 727 bytes --]
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-10-15 9:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15 9:40 [Ada] Fix range check on constrained array with expanded index name Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).