]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Crash on wrong renaming of record field
authorJavier Miranda <miranda@adacore.com>
Wed, 25 Feb 2026 18:08:37 +0000 (18:08 +0000)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 28 May 2026 08:52:48 +0000 (10:52 +0200)
gcc/ada/ChangeLog:

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

gcc/ada/sem_ch8.adb

index 66d4b355bbfb7f9bf43bbb15ca49e8d885a40d36..3256653b6a759f66ecc1c08513abb69d2df0629e 100644 (file)
@@ -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)))