aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2023-02-01 17:46:17 +0100
committerEric Botcazou <ebotcazou@adacore.com>2023-09-27 10:16:25 +0200
commitbb15f0c3762b5e0ff5615a4fec091c6e66590041 (patch)
tree38e54b5f67cc33c75431d1e28dc4633c9853e034 /gcc
parent3959b731971ef57c3e27855e54bddefa2fa5d9d5 (diff)
downloadgcc-bb15f0c3762b5e0ff5615a4fec091c6e66590041.zip
gcc-bb15f0c3762b5e0ff5615a4fec091c6e66590041.tar.gz
gcc-bb15f0c3762b5e0ff5615a4fec091c6e66590041.tar.bz2
ada: Fix crash on Ada.Containers with No_Dispatching_Calls restriction
This makes it so that the compiler does not crash and flags the underlying violation of the restriction instead. gcc/ada/ * exp_ch3.adb (Freeze_Type): Do not associate the Finalize_Address routine for a class-wide type if restriction No_Dispatching_Calls is in effect.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/exp_ch3.adb6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index abe71b2..da4d52a 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -9251,9 +9251,13 @@ package body Exp_Ch3 is
-- this is indeed the case, associate the Finalize_Address routine
-- of the full view with the finalization masters of all pending
-- access types. This scenario applies to anonymous access types as
- -- well.
+ -- well. But the Finalize_Address routine is missing if the type is
+ -- class-wide and we are under restriction No_Dispatching_Calls, see
+ -- Expand_Freeze_Class_Wide_Type above for the rationale.
elsif Needs_Finalization (Typ)
+ and then (not Is_Class_Wide_Type (Typ)
+ or else not Restriction_Active (No_Dispatching_Calls))
and then Present (Pending_Access_Types (Typ))
then
E := First_Elmt (Pending_Access_Types (Typ));