public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Eric Botcazou <ebotcazou@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-7855] ada: Fix crash on Ada.Containers with No_Dispatching_Calls restriction
Date: Wed, 27 Sep 2023 08:24:07 +0000 (GMT)	[thread overview]
Message-ID: <20230927082407.F155F3861888@sourceware.org> (raw)

https://gcc.gnu.org/g:bb15f0c3762b5e0ff5615a4fec091c6e66590041

commit r13-7855-gbb15f0c3762b5e0ff5615a4fec091c6e66590041
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Wed Feb 1 17:46:17 2023 +0100

    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.

Diff:
---
 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 abe71b252e7..da4d52a3d16 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));

                 reply	other threads:[~2023-09-27  8:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230927082407.F155F3861888@sourceware.org \
    --to=ebotcazou@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).