From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1285) id F155F3861888; Wed, 27 Sep 2023 08:24:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F155F3861888 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1695803047; bh=RrzQOirUTHQi+lSSk+zRLOzMBmm5S5hHil72JKALsuo=; h=From:To:Subject:Date:From; b=upc/gDSSsEfpBawXCY3HzJHrncTVECN+IXH3cMPzdG2AMUAObQLpGJIn1m0QnWz+9 vOS21AbZaRclPDY2PXKzkhrk2ovHRfpqx2HsbCJtnH5KpwsEKjtBDXHDokpoQfjdkC vFldPmrY6Qd8Cqu8Q+T6IoJ1vki1nT6okOF/M/NU= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Eric Botcazou To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-7855] ada: Fix crash on Ada.Containers with No_Dispatching_Calls restriction X-Act-Checkin: gcc X-Git-Author: Eric Botcazou X-Git-Refname: refs/heads/releases/gcc-13 X-Git-Oldrev: 3959b731971ef57c3e27855e54bddefa2fa5d9d5 X-Git-Newrev: bb15f0c3762b5e0ff5615a4fec091c6e66590041 Message-Id: <20230927082407.F155F3861888@sourceware.org> Date: Wed, 27 Sep 2023 08:24:07 +0000 (GMT) List-Id: https://gcc.gnu.org/g:bb15f0c3762b5e0ff5615a4fec091c6e66590041 commit r13-7855-gbb15f0c3762b5e0ff5615a4fec091c6e66590041 Author: Eric Botcazou 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));