From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1285) id 013A3386483A; Wed, 27 Sep 2023 08:28:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 013A3386483A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1695803322; bh=+nS2FzeLAHvpc453SzfPeeDBFyRQ0BY9KGCbqStgV3w=; h=From:To:Subject:Date:From; b=UA3InSxwbe0qgHY68TRaNBz0/NI7NVKcd52TCdIJkpTsk7aqhz58UVPaYJHKJ32Qg Gov1KTSHJTYSiB65nrRQxOBrmiaUE/bijii6lld7OdbA531Bt2/5mrsdGn/l78383/ 6+G3OXSB1/02BaN6phqpDEzt+D5ZJxv55tfPyBTM= 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-7908] ada: Fix internal error on aggregate nested in container aggregate X-Act-Checkin: gcc X-Git-Author: Eric Botcazou X-Git-Refname: refs/heads/releases/gcc-13 X-Git-Oldrev: 419e0f26eaa57b0fe7cdda5fd7303318bdbe9e78 X-Git-Newrev: a44435c1d2e1c13dd5ba60ad38feec7f7b1899da Message-Id: <20230927082842.013A3386483A@sourceware.org> Date: Wed, 27 Sep 2023 08:28:41 +0000 (GMT) List-Id: https://gcc.gnu.org/g:a44435c1d2e1c13dd5ba60ad38feec7f7b1899da commit r13-7908-ga44435c1d2e1c13dd5ba60ad38feec7f7b1899da Author: Eric Botcazou Date: Wed Sep 6 09:37:29 2023 +0200 ada: Fix internal error on aggregate nested in container aggregate This handles the case where a component association is present. gcc/ada/ * exp_aggr.adb (Convert_To_Assignments): In the case of a component association, call Is_Container_Aggregate on the parent's parent. (Expand_Array_Aggregate): Likewise. Diff: --- gcc/ada/exp_aggr.adb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index f78d339961e..306f17bb5bf 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -5018,9 +5018,11 @@ package body Exp_Aggr is -- excluding container aggregates as these are transformed into -- subprogram calls later. - (Parent_Kind in - N_Component_Association | N_Aggregate | N_Extension_Aggregate - and then not Is_Container_Aggregate (Parent_Node)) + (Parent_Kind = N_Component_Association + and then not Is_Container_Aggregate (Parent (Parent_Node))) + + or else (Parent_Kind in N_Aggregate | N_Extension_Aggregate + and then not Is_Container_Aggregate (Parent_Node)) -- Allocator (see Convert_Aggr_In_Allocator) @@ -6898,10 +6900,10 @@ package body Exp_Aggr is Parent_Kind := Nkind (Parent_Node); end if; - if ((Parent_Kind = N_Component_Association - or else Parent_Kind = N_Aggregate - or else Parent_Kind = N_Extension_Aggregate) - and then not Is_Container_Aggregate (Parent_Node)) + if (Parent_Kind = N_Component_Association + and then not Is_Container_Aggregate (Parent (Parent_Node))) + or else (Parent_Kind in N_Aggregate | N_Extension_Aggregate + and then not Is_Container_Aggregate (Parent_Node)) or else (Parent_Kind = N_Object_Declaration and then (Needs_Finalization (Typ) or else Is_Special_Return_Object