From: Javier Miranda <mira...@adacore.com> 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 Tested on x86_64-pc-linux-gnu, committed on master. --- 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 beb2e2f90f0..c1d5fa3c08b 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.42.0