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