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

Ada: Drop renamings when dropping an unused subprogram.

The Ada compiler ensures that renamings of unused subprograms are also dropped during unnesting, preventing potential issues.

The Ada compiler now tracks subprogram renamings during unnesting and ensures that these renamings are dropped when the subprogram is determined to be unused. This change prevents potential issues related to dangling references to renamed subprograms that are no longer reachable.

In Details

This commit modifies exp_unst.adb to handle subprogram renamings during unnesting. The compiler may drop subprograms deemed unreachable by reachability analysis. The change ensures that any renamings associated with these dropped subprograms are also removed. New functions Nullify_Renamings and Move_Pending_Renamings are introduced, and the Subp_Entry record in exp_unst.ads is extended with a Renamings component.

For Context

Compilers often perform optimizations to remove unused code. This commit addresses a specific scenario in the Ada compiler where a subprogram (similar to a function) is removed because it's never called. If a subprogram is renamed, the compiler must also remove the renaming when the original subprogram is removed to avoid errors.

Filed Under: adacompilerbugfixoptimization