]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Crash checking accessibility level on private type
authorJustin Squirek <squirek@adacore.com>
Thu, 11 Apr 2024 19:13:52 +0000 (19:13 +0000)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 10 Jun 2024 09:04:00 +0000 (11:04 +0200)
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.

gcc/ada/accessibility.adb

index 33ce001718a2b1fb162a003f012a5f0ab290d0bc..47b3a7af10a59434500da31f4b5602a58e1fe74a 100644 (file)
@@ -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;