* [Ada] Fix for resolution of overloaded subprogram for Iterable aspect
@ 2022-07-04 7:50 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-07-04 7:50 UTC (permalink / raw)
To: gcc-patches; +Cc: Piotr Trojanek
[-- Attachment #1: Type: text/plain, Size: 486 bytes --]
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.
Tested on x86_64-pc-linux-gnu, committed on trunk
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.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 500 bytes --]
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
--- 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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-07-04 7:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-04 7:50 [Ada] Fix for resolution of overloaded subprogram for Iterable aspect Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).