diff options
author | Justin Squirek <squirek@adacore.com> | 2021-08-14 07:32:17 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-10-04 08:45:05 +0000 |
commit | 43362d74b08ce76e44f6dbea8d133e739054f87f (patch) | |
tree | 4e0ffbe5b6c0dce0c4f47ebc849e13d79e21cbf2 /gcc | |
parent | cf1c69fb8c6b4ce894b95250028ed1ae5982c739 (diff) | |
download | gcc-43362d74b08ce76e44f6dbea8d133e739054f87f.zip gcc-43362d74b08ce76e44f6dbea8d133e739054f87f.tar.gz gcc-43362d74b08ce76e44f6dbea8d133e739054f87f.tar.bz2 |
[Ada] Crash on allocator in alternative accessibility modes
gcc/ada/
* sem_util.adb (Function_Or_Allocator_Level): Properly handle
direct function calls in the default alternative accessibility
checking mode.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/sem_util.adb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index e206e2f..47c3401 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -391,8 +391,7 @@ package body Sem_Util is and then (Is_Static_Coextension (N) or else Is_Dynamic_Coextension (N)) then - return Make_Level_Literal - (Scope_Depth (Standard_Standard)); + return Make_Level_Literal (Scope_Depth (Standard_Standard)); end if; -- Named access types have a designated level @@ -416,9 +415,14 @@ package body Sem_Util is if Debug_Flag_Underscore_B then return Make_Level_Literal (Typ_Access_Level (Etype (N))); - -- Otherwise the level is that of the subprogram + -- For function calls the level is that of the subprogram, + -- otherwise (for allocators etc.) we get the level of the + -- corresponding anonymous access type which is calculated + -- through the normal path of execution. - else + elsif Nkind (N) = N_Function_Call + and then Nkind (Name (N)) /= N_Explicit_Dereference + then return Make_Level_Literal (Subprogram_Access_Level (Entity (Name (N)))); end if; @@ -29287,7 +29291,7 @@ package body Sem_Util is (Designated_Type (Btyp), Allow_Alt_Model); end if; - -- When an anonymous access type's Assoc_Ent is specifiedi, + -- When an anonymous access type's Assoc_Ent is specified, -- calculate the result based on the general accessibility -- level routine. |