From: Javier Miranda <[email protected]>

gcc/ada/ChangeLog:

        * sem_ch8.adb (Find_Renamed_Entity): Protect call to First_Formal.

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

---
 gcc/ada/sem_ch8.adb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index 66d4b355bbf..3256653b6a7 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -8163,7 +8163,8 @@ package body Sem_Ch8 is
                Old_S := Entity (Nam);
             end if;
 
-         elsif Present (First_Formal (Entity (Nam)))
+         elsif Can_Have_Formals (Entity (Nam))
+           and then Present (First_Formal (Entity (Nam)))
            and then Present (First_Formal (New_S))
            and then Base_Type (Etype (First_Formal (Entity (Nam)))) =
                     Base_Type (Etype (First_Formal (New_S)))
-- 
2.53.0

Reply via email to