GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ada

Avoid compiler hang with cyclic homonym lists.

The Ada compiler now avoids introducing cycles in homonym lists during error handling, preventing potential hangs.

The Ada compiler could hang when encountering a semantically incorrect program due to cycles in the homonyms list. This commit prevents the introduction of such cycles during error handling within the Install_Entity function. Specifically, if an entity is already installed, the compiler now asserts that an error has been flagged and returns without modifying the homonyms list, thus avoiding the cycle.

In Details

This commit addresses a potential hang in sem_ch6.adb (Install_Entity) caused by introducing cycles in the Homonyms list during error recovery. The fix ensures that if an entity is already installed, the function returns without modifying the Homonyms list, provided an error has already been flagged. This prevents the creation of cyclic dependencies.

For Context

In a compiler, a homonyms list is a data structure that tracks symbols with the same name but different meanings within a given scope. This commit fixes a bug in the Ada compiler that could cause it to hang when encountering a semantically incorrect program. The bug was caused by the compiler incorrectly updating the homonyms list when handling errors, which could lead to a cycle in the list and cause the compiler to enter an infinite loop.

Filed Under: adacompilerbugfixerror handling