]> gcc.gnu.org Git - gcc.git/commitdiff
ada: Crash processing the accessibility level of an actual parameter
authorJavier Miranda <miranda@adacore.com>
Fri, 15 Sep 2023 13:08:25 +0000 (13:08 +0000)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 26 Sep 2023 11:43:18 +0000 (13:43 +0200)
gcc/ada/

* exp_ch6.adb (Expand_Call_Helper): When computing the
accessibility level of an actual parameter based on the
expresssion of a constant declaration, add missing support for
deferred constants

gcc/ada/exp_ch6.adb

index beb2e2f90f003144fcc807a7ee1e710f329cc5e7..c1d5fa3c08b014c6c4b74b4f22817801b9057741 100644 (file)
@@ -4352,13 +4352,23 @@ package body Exp_Ch6 is
                --  Generate the accessibility level based on the expression in
                --  the constant's declaration.
 
-               Add_Extra_Actual
-                 (Expr => Accessibility_Level
-                            (Expr            => Expression
-                                                  (Parent (Entity (Prev))),
-                             Level           => Dynamic_Level,
-                             Allow_Alt_Model => False),
-                  EF   => Extra_Accessibility (Formal));
+               declare
+                  Ent : Entity_Id := Entity (Prev);
+
+               begin
+                  --  Handle deferred constants
+
+                  if Present (Full_View (Ent)) then
+                     Ent := Full_View (Ent);
+                  end if;
+
+                  Add_Extra_Actual
+                    (Expr => Accessibility_Level
+                               (Expr            => Expression (Parent (Ent)),
+                                Level           => Dynamic_Level,
+                                Allow_Alt_Model => False),
+                     EF   => Extra_Accessibility (Formal));
+               end;
 
             --  Normal case
 
This page took 0.072408 seconds and 5 git commands to generate.