* [COMMITTED] ada: Fix crash on Ada.Containers with No_Dispatching_Calls restriction
@ 2023-05-22 8:50 Marc Poulhiès
0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2023-05-22 8:50 UTC (permalink / raw)
To: gcc-patches; +Cc: Eric Botcazou
From: Eric Botcazou <ebotcazou@adacore.com>
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.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/exp_ch3.adb | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index 363186565f6..33e96a0ff90 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));
--
2.40.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-22 8:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-22 8:50 [COMMITTED] ada: Fix crash on Ada.Containers with No_Dispatching_Calls restriction Marc Poulhiès
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).