THURSDAY, JULY 30, 2026
Ada
Ada: Fix bogus error on Unrestricted_Access of overloaded subprograms
Corrects an error in analyzing the GNAT-specific Unrestricted_Access attribute for overloaded Ada subprograms.
This commit addresses a bug in the Ada compiler’s analysis of the GNAT-specific ‘Unrestricted_Access attribute when applied to overloaded subprograms. Previously, the Analyze_Attribute function incorrectly generated an error in this scenario. The fix aligns the handling of Unrestricted_Access with that of other access attributes like [Unchecked_]Access, resolving the bogus error.
In Details
Adjusts Analyze_Attribute in gcc/ada/sem_attr.adb to treat the GNAT-specific Unrestricted_Access attribute similarly to [Unchecked_]Access concerning prefix overloading. This resolves PR ada/126482, where overloaded subprograms caused a spurious error.
For Context
- Unrestricted_Access attribute
- A GNAT-specific Ada attribute that allows creating access types (pointers) to entities that are not normally allowed, such as subprograms.
- overloaded subprogram
- In Ada, a subprogram (procedure or function) that shares the same name as another subprogram but has a different parameter list, allowing it to be distinguished by its signature.
- access type
- In Ada, a type that denotes a pointer to an object of another type. It is the Ada equivalent of a pointer in languages like C.
- GNAT
- The GNU Ada Translator, the primary compiler for the Ada programming language within the GNU toolchain.