https://gcc.gnu.org/g:cfc57c702abbc375f0869ae42632be31eacfa161
commit r16-9004-gcfc57c702abbc375f0869ae42632be31eacfa161 Author: Steve Baird <[email protected]> Date: Thu Feb 26 15:59:07 2026 -0800 ada: Compiler hangs on a semantically incorrect program. A homonyms list should be acyclic. Do not introduce a cycle in an error case. gcc/ada/ChangeLog: * sem_ch6.adb (Install_Entity): If the entity to be installed is already installed, assert that an error has already been flagged and then return without introducing a cycle in the entity's Homonyms list. Diff: --- gcc/ada/sem_ch6.adb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 022590444537..8b7cca210b99 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -10930,9 +10930,14 @@ package body Sem_Ch6 is procedure Install_Entity (E : Entity_Id) is Prev : constant Entity_Id := Current_Entity (E); begin + if Prev = E then + -- avoid creating a Homonym-list cycle + pragma Assert (Serious_Errors_Detected > 0); + return; + end if; + Set_Is_Immediately_Visible (E); Set_Current_Entity (E); - pragma Assert (Prev /= E); Set_Homonym (E, Prev); end Install_Entity;
