aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2023-09-15 13:08:25 +0000
committerMarc Poulhiès <poulhies@adacore.com>2023-09-26 13:43:18 +0200
commit52a7e4c75f16f9cd441a7a73142840f7c43c1224 (patch)
tree0fb10a1aa2f3350138a724e5790ffe019698daaf
parent2e135bdb28d386b0cda2ee7e35338ad06136042d (diff)
downloadgcc-52a7e4c75f16f9cd441a7a73142840f7c43c1224.zip
gcc-52a7e4c75f16f9cd441a7a73142840f7c43c1224.tar.gz
gcc-52a7e4c75f16f9cd441a7a73142840f7c43c1224.tar.bz2
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
-rw-r--r--gcc/ada/exp_ch6.adb24
1 files changed, 17 insertions, 7 deletions
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index beb2e2f..c1d5fa3 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