From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7871) id A844F3857C43; Tue, 20 Jun 2023 07:46:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A844F3857C43 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687247186; bh=wxGduQlM2gCL1YtlVsQ/FzfML0eIk3Kiow+wb1LZBRY=; h=From:To:Subject:Date:From; b=dy/W78xco/z9amoZ42IVGI97+zbrrGkz9Up+Nr28U+OROIC2SWCwEdZSdvdR3fJ1/ 7ImRFWuINwqjpDd//OyxcxCUZzovz/5xUy4yllKpX7inpV7S9TC/mm0rVUfaNgeTNB e3O1AD/mTVPUkDUUEJU/kZczHp2lSuYzHy/JXNbw= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Marc Poulhi?s To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-1968] ada: Fix internal error on aggregate within container aggregate X-Act-Checkin: gcc X-Git-Author: Eric Botcazou X-Git-Refname: refs/heads/master X-Git-Oldrev: 3404e481d09d49311ef74a8de15d8a72ed240cce X-Git-Newrev: d22792bc24fa1df6d23ace67ca127fdcde979031 Message-Id: <20230620074626.A844F3857C43@sourceware.org> Date: Tue, 20 Jun 2023 07:46:26 +0000 (GMT) List-Id: https://gcc.gnu.org/g:d22792bc24fa1df6d23ace67ca127fdcde979031 commit r14-1968-gd22792bc24fa1df6d23ace67ca127fdcde979031 Author: Eric Botcazou Date: Fri May 26 00:09:14 2023 +0200 ada: Fix internal error on aggregate within container aggregate This just applies the same fix to Expand_Array_Aggregate as the one that was recently applied to Convert_To_Assignments. gcc/ada/ * exp_aggr.adb (Convert_To_Assignments): Tweak comment. (Expand_Array_Aggregate): Do not delay the expansion if the parent node is a container aggregate. 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 fb5f404922f..5e22fefbc1d 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -4244,9 +4244,9 @@ package body Exp_Aggr is -- done top down from above. if - -- Internal aggregate (transformed when expanding the parent) - -- excluding the Container aggregate as these are transformed to - -- procedure call later. + -- Internal aggregates (transformed when expanding the parent), + -- excluding container aggregates as these are transformed into + -- subprogram calls later. (Parent_Kind in N_Component_Association | N_Aggregate | N_Extension_Aggregate @@ -6108,7 +6108,8 @@ package body Exp_Aggr is -- STEP 3 -- Delay expansion for nested aggregates: it will be taken care of when - -- the parent aggregate is expanded. + -- the parent aggregate is expanded, excluding container aggregates as + -- these are transformed into subprogram calls later. Parent_Node := Parent (N); Parent_Kind := Nkind (Parent_Node); @@ -6118,9 +6119,10 @@ package body Exp_Aggr is Parent_Kind := Nkind (Parent_Node); end if; - if Parent_Kind = N_Aggregate - or else Parent_Kind = N_Extension_Aggregate - or else Parent_Kind = N_Component_Association + 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)) or else (Parent_Kind = N_Object_Declaration and then (Needs_Finalization (Typ) or else Is_Special_Return_Object