]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Accessibility fix
authorGhjuvan Lacambre <lacambre@adacore.com>
Wed, 27 Oct 2021 11:26:38 +0000 (13:26 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 9 Nov 2021 09:44:49 +0000 (09:44 +0000)
gcc/ada/

* sem_util.adb (Accessibility_Level): Use init_proc_level_formal
instead of computing a new accessibility level from Scope_Depth
(E).

gcc/ada/sem_util.adb

index bc51a60ccf2a84399948d214c27d3f6210c543ad..c8362f57b177dcca578a58026988cbb916f1db41 100644 (file)
@@ -744,6 +744,13 @@ package body Sem_Util is
             then
                return Accessibility_Level (Related_Expression (E));
 
+            elsif Level = Dynamic_Level
+               and then Ekind (E) in E_In_Parameter | E_In_Out_Parameter
+               and then Present (Init_Proc_Level_Formal (Scope (E)))
+            then
+               return New_Occurrence_Of
+                        (Init_Proc_Level_Formal (Scope (E)), Loc);
+
             --  Normal object - get the level of the enclosing scope
 
             else