From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by sourceware.org (Postfix) with ESMTPS id AF3F73858436 for ; Tue, 20 Jun 2023 07:46:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AF3F73858436 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-4f8735ac3e3so2366503e87.2 for ; Tue, 20 Jun 2023 00:46:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1687247218; x=1689839218; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=bNWfXR/mG7Za32+iJUjWKXGTQ0C+wB74YjarqTniAX0=; b=FU/6A3wNJi86pHiDeKLQ/y37uyNUF/PAgRvd+2eqWKYgTvJKkOvFOSnHC5oyqY3Ab0 6chdx096ekkSwoAP+sQGIeoRQfA8Ug+uAxrAuY5QGSG203dkucfu0Oc4IjCQ3VTrB9np BZv0f9OxTnqbLVwHE0UrqwgnqH5jz3xPCNlOIWiBZlMZMKvRhwx5+TZgxJfwnHpPWL+U Ohxy43CY8qp9daHCtXODCxIZO7D7qL/eMULonuZhOUYjpWwyGk6WGo418uz0PxFcQXyV kPxwCUHYH/PI4CokIRzM1Qh6rXVYhWv9MMjHb6wAgPP7WxC/J111K/CK1EZirJz7N5Tj yJ0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687247218; x=1689839218; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bNWfXR/mG7Za32+iJUjWKXGTQ0C+wB74YjarqTniAX0=; b=SRrzP/RWTYCImPmhamiNbhWvD2i7jC5gH8hdvxoNIT1mfwrsLVJegyGo7vPeAjWAh0 pq0owaWGR7MuBCH+EB9ABiY+biYO0+4G2XI1DPCtGjQc/wlBOY0QhaLAy4iU3z4n5I5c djsGDZq/qEKYnSrGs5TBUJnni2p2/Z6/b+/D4TrYTmMWxBW+BrSCO0vtLLqTlZYZyxYS wtap6ivfm31B9Dw+Ttvhfwv+ptj//gw4Zmn+BMryUsDaMM+Z91wv7XawyUaMfzNTR8TW eDkbvaHHZZ3RA++oNtab1sg41T5rU/Ritndr16Hmwdh0aovaqMNx8INkZaYRPlu5zvjr PXiA== X-Gm-Message-State: AC+VfDxk3WOp5koIJlcW340laBLw8iqJiVSFg6mCDEURjLprsCBFjw1G AKUy6gFjSTF6lToEZUaRNZPZp6I35x+5IqDcveGPVQ== X-Google-Smtp-Source: ACHHUZ5WNvaWzYX+dXCsDHsrNRX8v6q3UwJiyYIWofQOYMrGbj+AbvRBlo2uK8ugwWDVsjoBedkBPQ== X-Received: by 2002:a19:7712:0:b0:4f8:752f:371f with SMTP id s18-20020a197712000000b004f8752f371fmr2140521lfc.51.1687247218147; Tue, 20 Jun 2023 00:46:58 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:4c16:36ea:1b76:c001]) by smtp.gmail.com with ESMTPSA id z3-20020a1c4c03000000b003f9b3ccb815sm3366426wmf.1.2023.06.20.00.46.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 00:46:57 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Fix internal error on aggregate within container aggregate Date: Tue, 20 Jun 2023 09:46:56 +0200 Message-Id: <20230620074656.1252745-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Eric Botcazou 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. Tested on x86_64-pc-linux-gnu, committed on master. --- 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 -- 2.40.0