From 52a7e4c75f16f9cd441a7a73142840f7c43c1224 Mon Sep 17 00:00:00 2001 From: Javier Miranda Date: Fri, 15 Sep 2023 13:08:25 +0000 Subject: [PATCH] ada: Crash processing the accessibility level of an actual parameter 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 | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index beb2e2f90f00..c1d5fa3c08b0 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -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 -- 2.43.5