From: Piotr Trojanek Date: Fri, 20 May 2022 20:29:51 +0000 (+0200) Subject: [Ada] Fix for resolution of overloaded subprogram for Iterable aspect X-Git-Tag: basepoints/gcc-14~5785 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=df69e326b39dabc34f0c9b31f694079e5fa1343a;p=thirdparty%2Fgcc.git [Ada] Fix for resolution of overloaded subprogram for Iterable aspect When resolving the Iterable aspect we look for a functions that are declared in the same scope as the annotated type and that have the required number and types formal parameters. However, we didn't guard against functions that have no formal parameter at all. gcc/ada/ * sem_ch13.adb (Resolve_Iterable_Operation): Add guard to prevent crash when the examined function has no formal parameters and Etype is called on Empty entity. --- diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 0b8911b8dcd..27f32504999 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -15943,6 +15943,7 @@ package body Sem_Ch13 is while Present (It.Typ) loop if Ekind (It.Nam) = E_Function and then Scope (It.Nam) = Scope (Typ) + and then Present (First_Formal (It.Nam)) and then Etype (First_Formal (It.Nam)) = Typ then F1 := First_Formal (It.Nam);