]> gcc.gnu.org Git - gcc.git/commitdiff
ada: Assertion failure on for-of loop iterating on selected component
authorJavier Miranda <miranda@adacore.com>
Mon, 28 Aug 2023 18:32:18 +0000 (18:32 +0000)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 14 Sep 2023 12:42:38 +0000 (14:42 +0200)
gcc/ada/

* sem_util.adb (Is_Dependent_Component_Of_Mutable_Object): Protect
access to Entity attribute and add missing code to check function
selector in a prefix form call.

gcc/ada/sem_util.adb

index 35ec296ab932c0780db0aba0f70887c8424737d2..3229f4e9dd2bdb560a9f30943d3fe63df586d5fc 100644 (file)
@@ -16509,8 +16509,13 @@ package body Sem_Util is
             --  False (it could be a function selector in a prefix form call
             --  occurring in an iterator specification).
 
-            if Ekind (Entity (Selector_Name (Object))) not in
-                 E_Component | E_Discriminant
+            if (Present (Entity (Selector_Name (Object)))
+                  and then Ekind (Entity (Selector_Name (Object))) not in
+                             E_Component | E_Discriminant)
+              or else
+                (Inside_A_Generic
+                   and then Nkind (Parent (Selector_Name (Object)))
+                              = N_Function_Call)
             then
                return False;
             end if;
This page took 0.074676 seconds and 5 git commands to generate.