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

Fix crash when using address clause on declare-expression constant

This commit fixes a crash in the Ada compiler that occurred when using an address clause on a constant defined within a declare-expression.

This commit resolves a crash in the Ada compiler triggered by using an address clause on a constant declared within a declare-expression. The fix involves associating a scope link with N_Expression_With_Actions nodes and properly managing the scope during resolution, preventing improper visibility of the declared items.

In Details

The crash occurred due to incorrect scope handling during the resolution of declare-expressions. The fix introduces a Scope_Link field to N_Expression_With_Actions in gen_il-fields.ads and related files. The Resolve_Declare_Expression function in sem_res.adb now pushes/pops the internally created scope to ensure proper visibility.

For Context

In Ada, a 'declare-expression' allows you to declare variables and constants within an expression. An 'address clause' lets you specify the memory address where a variable or constant should be located. This commit fixes a bug where the compiler would crash if you tried to specify the address of a constant declared inside a declare-expression. The fix ensures that the compiler correctly handles the scope and visibility of these constants.

Filed Under: adacrashbugfix