]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix assertion failure on private limited with clause
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 16 Aug 2024 23:18:43 +0000 (01:18 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 29 Aug 2024 13:06:28 +0000 (15:06 +0200)
This checks that the name is of an entity before accessing its Entity field.

gcc/ada/

* sem_ch8.adb (Has_Private_With): Add test on Is_Entity_Name.

gcc/ada/sem_ch8.adb

index 990600614719cc7db2c8b3a3766606730bd99f50..13c44c5e302c84e3d3abc29e8284f1f1111a6930 100644 (file)
@@ -8980,6 +8980,7 @@ package body Sem_Ch8 is
       while Present (Item) loop
          if Nkind (Item) = N_With_Clause
            and then Private_Present (Item)
+           and then Is_Entity_Name (Name (Item))
            and then Entity (Name (Item)) = E
          then
             return True;