aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch6.adb
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2025-09-02 15:58:26 -0700
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2025-09-02 15:58:26 -0700
commit071b4126c613881f4cb25b4e5c39032964827f88 (patch)
tree7ed805786566918630d1d617b1ed8f7310f5fd8e /gcc/ada/exp_ch6.adb
parent845d23f3ea08ba873197c275a8857eee7edad996 (diff)
parentcaa1c2f42691d68af4d894a5c3e700ecd2dba080 (diff)
downloadgcc-devel/gfortran-test.zip
gcc-devel/gfortran-test.tar.gz
gcc-devel/gfortran-test.tar.bz2
Merge branch 'master' into gfortran-testdevel/gfortran-test
Diffstat (limited to 'gcc/ada/exp_ch6.adb')
-rw-r--r--gcc/ada/exp_ch6.adb14
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index eb7422c..e877469 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -921,7 +921,8 @@ package body Exp_Ch6 is
-- in accessibility.adb (which can cause the extra formal parameter
-- needed for the check(s) generated here to be missing in the case
-- of a tagged result type); this is a workaround and can
- -- prevent generation of a required check.
+ -- prevent generation of a required check (or even a required
+ -- legality check - see "statically too deep" check below).
if No (Extra_Accessibility_Of_Result (Func)) then
return;
@@ -969,6 +970,15 @@ package body Exp_Ch6 is
Accessibility_Level (Discr_Exp, Level => Dynamic_Level);
Analyze (Discrim_Level);
+ if Nkind (Discrim_Level) = N_Integer_Literal
+ and then Intval (Discrim_Level) > Scope_Depth (Func)
+ then
+ Error_Msg_N
+ ("level of type of access discriminant value of "
+ & "return expression is statically too deep",
+ Enclosing_Declaration_Or_Statement (Exp));
+ end if;
+
Insert_Action (Exp,
Make_Raise_Program_Error (Loc,
Condition =>
@@ -8089,7 +8099,7 @@ package body Exp_Ch6 is
Get_Class_Wide_Pragma (Id, Pragma_Precondition);
begin
- if No (Prag) or else Is_Ignored (Prag) then
+ if No (Prag) or else Is_Ignored_In_Codegen (Prag) then
return;
end if;