From patchwork Tue Jun 20 07:46:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 110289 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3494572vqr; Tue, 20 Jun 2023 00:49:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5RJQ0fMiUmJ7YvtRUsbYP/EaQ16cOVHbXemhJNn7tpjVmzh82uoKSRlLTpTpH14D58GPSN X-Received: by 2002:a17:907:2d94:b0:96f:f046:9a92 with SMTP id gt20-20020a1709072d9400b0096ff0469a92mr11808706ejc.37.1687247346366; Tue, 20 Jun 2023 00:49:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687247346; cv=none; d=google.com; s=arc-20160816; b=cNzOpHxJYYlAZ7ZL951v/KtPiAXB/ALsz1cjjW1jewALuNCCivgfGwDPvFC9K/Y0AF v5UZQiiGA+hUNB26bBU6YkXD/1Sh4RN633V1g15EHkOGevetCjfeJuBV96agbGvkcJLk mTfxyKMKN0vymRVdY5HLV0rg22WSDFj8ecplPCBSxAc6AdnApD2oAYMro4O/428iefl4 fTcJVhSrmaEBTPllRzkdZq0qV07/BTyRorrbbtS1yRjBG2OgzCOzeNDb0kccFaNLa/l6 C0rmcAvha6D6cUBr0o49RNiO5GrmBe1p20Y78KmHioJi5BtBRBKARbY1pcOW+kTC0Vlv EQbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=bNWfXR/mG7Za32+iJUjWKXGTQ0C+wB74YjarqTniAX0=; b=n1cJR8G7saRO/JfL/hc06FiVtypN6oGo84wDGNwuPrKfi9WSjK57e5zbH8kk6+ZmoQ KBqef44g1G1Zo30rRtMIZW1DZEA5cb9fo9cMmW7RupEN9OGR1mSGLie4j5hVHsChOiJZ xJsLZeZNbAqtT7GYpVK0k+yEEoQ2kSWTXbPfWRA7xNQg3kJTICB0tqsdRN+2FM7vtI6t vqiiRvvCmQ33NDmxvV5jo78ibkGGJj/llZumecYpW9RsRXZAE2z23S/o98vWgOd79s76 VD8trH/6vHZiDwLhQh7DmshnCeIAssWB1/1gEY814y0V/ow7U6U4UgarS4kF5k2xt+kn O8Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="AoSvdgC/"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id n10-20020a170906118a00b009888b617ebbsi862179eja.606.2023.06.20.00.49.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 00:49:06 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="AoSvdgC/"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 19F1F385660D for ; Tue, 20 Jun 2023 07:47:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 19F1F385660D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687247273; bh=bNWfXR/mG7Za32+iJUjWKXGTQ0C+wB74YjarqTniAX0=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=AoSvdgC/XXLweN1ZQypTOfFlHhMYIxrIAVJwgudtOHUE60MvV/YCuyNzsHqBBjhtq 1VrA6pHfbCc9jdn/wP9VaI3euzSvWu+X6I70oQg02XbpVkt5Yqq0Fg+nfQPzYvcjNo NswaSxoWk4FzBGk//pDHjaOyBqdRbux9evYQrixM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-4f8735ac3e3so2366503e87.2 for ; Tue, 20 Jun 2023 00:46:59 -0700 (PDT) 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-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) 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 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: =?utf-8?q?Marc_Poulhi=C3=A8s?= Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769207073414650739?= X-GMAIL-MSGID: =?utf-8?q?1769207073414650739?= 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