diff options
author | Justin Squirek <squirek@adacore.com> | 2024-05-10 11:18:01 +0000 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-06-14 09:34:18 +0200 |
commit | 1feb6d81a3ab587382817cd7a39222b6c83f68ac (patch) | |
tree | a067309407af69d5950c2832c5c92c365a89e818 /gcc/ada | |
parent | 34935c45c6e13093f9e2c2b1bc36483818152e9c (diff) | |
download | gcc-1feb6d81a3ab587382817cd7a39222b6c83f68ac.zip gcc-1feb6d81a3ab587382817cd7a39222b6c83f68ac.tar.gz gcc-1feb6d81a3ab587382817cd7a39222b6c83f68ac.tar.bz2 |
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): Replace call Get_Full_View with call to
Full_View since Get_Full_View only works with incomplete types.
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/accessibility.adb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/ada/accessibility.adb b/gcc/ada/accessibility.adb index 47b3a7a..da4d1d9 100644 --- a/gcc/ada/accessibility.adb +++ b/gcc/ada/accessibility.adb @@ -2227,7 +2227,11 @@ package body Accessibility is -- that of the type. elsif Ekind (Def_Ent) = E_Discriminant then - return Scope_Depth (Get_Full_View (Scope (Def_Ent))); + return Scope_Depth + (if Present (Full_View (Scope (Def_Ent))) then + Full_View (Scope (Def_Ent)) + else + Scope (Def_Ent)); end if; end if; |