aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorSteve Baird <baird@adacore.com>2023-08-10 16:21:34 -0700
committerMarc Poulhiès <poulhies@adacore.com>2023-09-05 13:05:13 +0200
commit9fc6f15bfe7ebfeef6ebbea48b2c551f79cd25bd (patch)
treec08bcda026eda51553b633cb7564d1675eeed999 /gcc/ada
parentbed30418f910df5ea605b7f5ee4b86a6ab7e9411 (diff)
downloadgcc-9fc6f15bfe7ebfeef6ebbea48b2c551f79cd25bd.zip
gcc-9fc6f15bfe7ebfeef6ebbea48b2c551f79cd25bd.tar.gz
gcc-9fc6f15bfe7ebfeef6ebbea48b2c551f79cd25bd.tar.bz2
ada: Compiler hangs on invalid postcondition
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.
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/sem_attr.adb4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index e00addd..d03761b 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;