* [COMMITTED] ada: Compiler hangs on invalid postcondition
@ 2023-09-05 11:08 Marc Poulhiès
0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2023-09-05 11:08 UTC (permalink / raw)
To: gcc-patches; +Cc: Steve Baird
From: Steve Baird <baird@adacore.com>
In some cases involving an illegal reference to F'Result in
the postcondition for a function not named F, the compiler would
hang instead of correctly diagnosing the error.
gcc/ada/
* sem_attr.adb (Denote_Same_Function): Handle the case where
Has_Homonym (Pref_Id) returns True but Homonym (Pref_Id) returns
an empty result.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/sem_attr.adb | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index e00addd0152..d03761b1e30 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -5921,7 +5921,9 @@ package body Sem_Attr is
-- When a qualified name is used for the prefix, homonyms may come
-- before the current function in the homonym chain.
- elsif Has_Homonym (Pref_Id) then
+ elsif Has_Homonym (Pref_Id)
+ and then Present (Homonym (Pref_Id))
+ then
return Denote_Same_Function (Homonym (Pref_Id), Spec_Id);
end if;
--
2.40.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-09-05 11:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-05 11:08 [COMMITTED] ada: Compiler hangs on invalid postcondition Marc Poulhiès
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).