The recent overhaul of the computation of the accessibility level of the
result of a function call in Ada 95 overlooked the case of a named access
type, which needs to be handled as in the other versions of the language.
Tested on x86-64/Linux, applied on the mainline
2026-11-12 Eric Botcazou <[email protected]>
* accessibility.adb (Function_Call_Or_Allocator_Level): Deal with a
named access result type in Ada 95 as in other language versions.
--
Eric Botcazoudiff --git a/gcc/ada/accessibility.adb b/gcc/ada/accessibility.adb
index 852b57e41df..97d333779d1 100644
--- a/gcc/ada/accessibility.adb
+++ b/gcc/ada/accessibility.adb
@@ -476,6 +476,11 @@ package body Accessibility is
then
return Type_Access_Level (Etype (Prefix (Name (N))));
+ -- Objects of a named access type get their level from their type
+
+ elsif Is_Named_Access_Type (Etype (N)) then
+ return Type_Access_Level (Etype (N));
+
-- Otherwise the accessibility level of the innermost master
else