https://gcc.gnu.org/g:c8985e8fcfb01e481e12048edae195e4b367b78a

commit r17-872-gc8985e8fcfb01e481e12048edae195e4b367b78a
Author: Javier Miranda <[email protected]>
Date:   Wed Feb 25 18:08:37 2026 +0000

    ada: Crash on wrong renaming of record field
    
    gcc/ada/ChangeLog:
    
            * sem_ch8.adb (Find_Renamed_Entity): Protect call to First_Formal.

Diff:
---
 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 66d4b355bbfb..3256653b6a75 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)))

Reply via email to