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

Reuse Boolean_Literals in rewriting of accessibility checks

The Ada compiler now reuses existing Boolean literal entities when rewriting accessibility checks, improving code efficiency.

This commit refactors the Ada compiler’s exp_ch4.adb to enhance how accessibility checks are handled. Specifically, the Expand_N_In function now reuses pre-existing Boolean_Literals entities (True/False arrays) instead of generating new ones during the rewriting of these checks. This is a code cleanup that improves the internal efficiency and maintainability of the compiler without altering its functional behavior.

In Details

This change in exp_ch4.adb impacts the Expand_N_In function, which is part of the expander phase in the Ada front-end. The expander translates high-level Ada constructs into lower-level intermediate representations. The modification involves reusing the Boolean_Literals (the compiler's internal representation of True and False) when rewriting expressions related to accessibility checks. Previously, the expander might have generated new entity objects for these literals, but now it leverages existing ones, reducing redundancy and improving code generation efficiency slightly.

For Context

Compilers work by taking your code and transforming it through several stages until it becomes a runnable program. One stage is called 'expansion,' where the compiler breaks down complex statements into simpler ones. This update improves a part of the Ada compiler that handles 'accessibility checks' – rules that ensure your program can safely access data. Specifically, when these checks are being rewritten, the compiler now reuses its internal representations of 'True' and 'False' rather than creating new ones every time. Think of it like a writer reusing a common phrase instead of retyping it each time; it's a small efficiency gain that makes the compiler's own code cleaner and potentially a tiny bit faster in its internal operations, without changing how your Ada programs function.

Filed Under: adacompilerrefactoringoptimization