GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ada

Ada: Prevent infinite recursion on broken subunits with -gnatc

Adds a cutoff to prevent infinite recursion when compiling broken Ada subunits with the -gnatc flag.

This commit addresses an infinite recursion issue that occurred when compiling broken Ada subunits with the -gnatc flag. A cutoff has been added in the invocation graph processing to handle these broken subunits gracefully, preventing the compiler from getting stuck.

In Details

Adds a cutoff in Invocation_Graph.Process_Package_Declaration in sem_elab.adb to prevent infinite recursion when encountering broken subunits during compilation with -gnatc.

For Context
subunit
In Ada, a compilation unit that is part of a larger package specification or body, allowing for modular development.
-gnatc
An Ada compiler flag that enables certain checks or modes of compilation, in this case related to subunit processing.
invocation graph
A data structure representing the dependencies between compilation units, used by the compiler to determine the correct order of processing.
Filed Under: adacompilerbugfix