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

Ada: Fixes missing accessibility check for anonymous access function result

This commit fixes a missing accessibility check for anonymous access function result in Ada, improving program safety.

This commit addresses a missing accessibility check for anonymous access function results in Ada. It refactors code to generate accessibility checks for single discriminants and moves routines for return accessibility checks. By consolidating the computation of minimum accessibility levels, this change enhances the safety and reliability of Ada programs by ensuring proper access control.

In Details

This commit modifies accessibility.ads and accessibility.adb, refactoring and renaming functions like Apply_Accessibility_Check to Apply_Accessibility_Check_For_Parameter and introducing Apply_Accessibility_Check_For_Return. It also touches exp_ch3.adb and exp_ch6.ads. These changes ensure consistent handling of accessibility levels, particularly for access results. No interaction with other subsystems is apparent.

For Context

Ada's accessibility checks prevent dangling pointers and other memory safety issues by restricting access to objects based on their lifetime and visibility. This commit fixes a bug that caused these checks to be missed in certain cases involving anonymous access functions. These changes improve the overall safety and robustness of Ada programs, preventing potential crashes or undefined behavior.

Filed Under: adaaccessibilitybugfix