https://gcc.gnu.org/g:c936305076919e6e7fcf7e8c6332c897571a2894

commit r15-1151-gc936305076919e6e7fcf7e8c6332c897571a2894
Author: Justin Squirek <squi...@adacore.com>
Date:   Thu Apr 11 19:13:52 2024 +0000

    ada: Crash checking accessibility level on private type
    
    This patch fixes an issue in the compiler whereby calculating a static
    accessibility level on a private type with an access discriminant resulted
    in a compile time crash when No_Dynamic_Accessibility_Checks is enabled.
    
    gcc/ada/
    
            * accessibility.adb (Accessibility_Level): Use Get_Full_View to
            avoid crashes when calculating scope.

Diff:
---
 gcc/ada/accessibility.adb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/ada/accessibility.adb b/gcc/ada/accessibility.adb
index 33ce001718a..47b3a7af10a 100644
--- a/gcc/ada/accessibility.adb
+++ b/gcc/ada/accessibility.adb
@@ -2227,7 +2227,7 @@ package body Accessibility is
                   --  that of the type.
 
                   elsif Ekind (Def_Ent) = E_Discriminant then
-                     return Scope_Depth (Scope (Def_Ent));
+                     return Scope_Depth (Get_Full_View (Scope (Def_Ent)));
                   end if;
                end if;

Reply via email to