https://gcc.gnu.org/g:13af1266d3ca014dc4e265e38c539e3686073a7a

commit r17-6181-g13af1266d3ca014dc4e265e38c539e3686073a7a
Author: Eric Botcazou <[email protected]>
Date:   Thu Nov 12 17:05:12 2026 +0100

    Ada: Fix bogus failure of dynamic accessibility check in Ada 95 mode
    
    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.
    
    gcc/ada/
            * accessibility.adb (Function_Call_Or_Allocator_Level): Deal with a
            named access result type in Ada 95 as in other language versions.

Diff:
---
 gcc/ada/accessibility.adb | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/ada/accessibility.adb b/gcc/ada/accessibility.adb
index 852b57e41dfd..97d333779d10 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

Reply via email to