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

Ada fixes missing error for deep accessibility in aggregate returns.

GCC's Ada compiler now correctly flags accessibility errors in aggregate returns and refines static accessibility checks for anonymous access types.

This commit resolves several issues within the GCC Ada front end related to accessibility checks. It fixes a missing error report for overly deep accessibility levels in aggregate returns involving function calls with prefixed forms. The change also adjusts the implementation of the Ada Reference Manual’s 6.5(5.9) rule to use a proper static accessibility check, preventing incorrect flagging of Ada 2012 stand-alone anonymous access types. Additionally, it streamlines the RM 3.10.2(28) rule by merging its implementations for named and anonymous access types into a single, consistent code block.

In Details

This extensive commit to the GCC Ada front end, primarily affecting accessibility.adb, sem_attr.adb, and sem_ch6.adb, addresses multiple accessibility-related issues. The first fixes a missing error case where Accessibility_Level failed to detect overly deep accessibility within aggregate returns, particularly when an access discriminant was derived from a prefixed function call inside the aggregate. Secondly, it revises the implementation of ALRM 6.5(5.9) within Check_Return_Construct_Accessibility to perform a truly static accessibility check, disengaging it from the dynamic check…

For Context

Compilers like GCC ensure that programs follow strong rules about how different parts of the code can access data, especially when dealing with memory addresses (called 'access types' in Ada). This is crucial for preventing crashes and security vulnerabilities. This update to the GCC Ada compiler tackles several complex issues in these 'accessibility checks'. One fix ensures that the compiler correctly reports an error if a program tries to return data in a way that creates an unsafe memory access, particularly when using advanced features like 'aggregate returns' with function calls. Another part of the change refines how the compiler checks for safe memory use with 'anonymous access types' (pointers without a direct name), specifically for a feature introduced in Ada 2012. It makes these checks 'static' (done at compile-time) rather than confusing them with 'dynamic' (runtime) checks. Lastly, the update simplifies the compiler's internal code by merging similar rules for named and u…

Filed Under: adacompiler-frontendaccessibility-checksada-2012bugfix