From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id EA6FD385BAC0; Mon, 4 Jul 2022 07:49:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EA6FD385BAC0 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-1422] [Ada] Fix for resolution of overloaded subprogram for Iterable aspect X-Act-Checkin: gcc X-Git-Author: Piotr Trojanek X-Git-Refname: refs/heads/master X-Git-Oldrev: 089a4a48ac3db93f07585563f3b41e92bac798fe X-Git-Newrev: df69e326b39dabc34f0c9b31f694079e5fa1343a Message-Id: <20220704074951.EA6FD385BAC0@sourceware.org> Date: Mon, 4 Jul 2022 07:49:51 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jul 2022 07:49:52 -0000 https://gcc.gnu.org/g:df69e326b39dabc34f0c9b31f694079e5fa1343a commit r13-1422-gdf69e326b39dabc34f0c9b31f694079e5fa1343a Author: Piotr Trojanek Date: Fri May 20 22:29:51 2022 +0200 [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: --- gcc/ada/sem_ch13.adb | 1 + 1 file changed, 1 insertion(+) 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);