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.
-- 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;