From patchwork Fri Sep 15 14:20: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: 140458 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1084335vqi; Fri, 15 Sep 2023 07:22:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFImQTj2q0Z+iGjs5rqfmPAEz9M0xTaHq3+ilcHv9gY65TirfPZaBsXNoXxqqFiQ1Eo8wmR X-Received: by 2002:aa7:c05a:0:b0:52f:a80b:83c9 with SMTP id k26-20020aa7c05a000000b0052fa80b83c9mr1488934edo.31.1694787773056; Fri, 15 Sep 2023 07:22:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694787773; cv=none; d=google.com; s=arc-20160816; b=tiIy1s21FkkXDfajzke5j5xEfbHVBe0WJ3WB8o3oclcr1aZ7CTZj7mWMmi98VvAxQC CQQS7aIS+g0Pm/bHH+KZga+IC+jUpwcDgsL76gtmmD1JKZlMoq7Fd5cz82HvbZ+qlCNq 7tpQ4fPZJ3JVIgihlbNaETVPjGmOwDLtnYXtrNDwd/mgwLe3o1UdLk9J1VjWkNwl4nXA gJp0SQUP1dsbxlKY+QiGRWnsSZQJOhh8JoHkebHU1CZtH5vZDCR5VGWAHfBd3a03zKqe 8vedUsnS/fIjAnukRBduaV03id1N1IKACJxI4oOFDTw9UOEbMBwO8YR/erxFPaD26Za4 I+gA== 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=niN8hg7boSvpVbVe5/nFymVDaEseOE9v4oyJOFdXa/w=; fh=hOhsC1930eHatDPYd2EALQ9Ry/g++vvN4vxlQkRuX+0=; b=YUyGD8m+H4KuKkRtyt5wXEx6KS5EMFYbaiyhRM3Rm+nN468uPe4O+xiE8YkhmV6B5A lBhTc0osqGFdV9AdO2XF3X5M//cE3tB5/Z6XIVsoVdLAw49v1Cx4xsSw3Xcg25HXVdw2 3KSuG4y/TCBMALg1hINlT99Drzc+f/vUJisnSWtqeQXfnUSAnHvJgU/Wims2kmRG/08y XiIBhfl5sNKWykcKO5lxdOpBrfhgBybxyH0ndhfXu8qNuoA+2n6oYqmYIyc6iOdLlbAT 7SvnNe5GxLeMQm02KnSrbiBbgcCUqvgljel76Nm1WVTUoOsMyOTo3tp0vnIAA2y7OmFT 96Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=t+emQo3r; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id d16-20020aa7ce10000000b0052a3d26a191si3471872edv.630.2023.09.15.07.22.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 07:22:53 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=t+emQo3r; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 036F53857700 for ; Fri, 15 Sep 2023 14:22:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 036F53857700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694787728; bh=niN8hg7boSvpVbVe5/nFymVDaEseOE9v4oyJOFdXa/w=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=t+emQo3rxmKt+xjNldWF7pJOlZslbfV5VFynBV89FfruDXXgnEM9bQPy2WDTSRnFE m8arE7vLQpO/UHxpHx98/2lzdsny5JU3ljms8rNyIxl4egbuhNBQv+0wiDIgqrAked 4ybYoGgk/D94kJBi83sNSrTFinQ9T9Fmk8T/aqyc= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id 225573858C00 for ; Fri, 15 Sep 2023 14:20:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 225573858C00 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40476ce8b2fso13595975e9.3 for ; Fri, 15 Sep 2023 07:20:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694787658; x=1695392458; 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=niN8hg7boSvpVbVe5/nFymVDaEseOE9v4oyJOFdXa/w=; b=EdHvGEECgzShXtnepf2Sk8HNxcZf3fQ5hb/GTarJiQJalRDwDL7D4k9ZX6IbkHxtkC 7jdsnr1eIET4JJCZ0TTQxmLelegbxd1dZPebULchw7CUfJvKmfY0b9HEgNlTjaRT3Gt8 C+F3zTvEnOIzBp4GB/JwAFIermHA6nY3LShwMo1gqXgh3UdDZq/1SMKf0iApsPeDgFWH pL5XnAqmIgTYSJZqiBtkQYkj8sIduP5SyJKUkvvJkXGSiMXRO8VFHKUugxB0LxRG/VzO YaoLbX+7dK3b+vINfhoiHys8gEp8coWR2P8xsl4J/BIXVfv7t5CnCRquHwFxEzL89AaO m9jQ== X-Gm-Message-State: AOJu0Yyhp6H4opliY6W7TlqjOxb73Pthb4EI5PX1jmJ+shi2rpIGtiMj FGCgqKd5aMC/l8rWl6wNu6vMV/tpLhbQnCg6nsJPfg== X-Received: by 2002:a7b:c40b:0:b0:401:be70:53b6 with SMTP id k11-20020a7bc40b000000b00401be7053b6mr1737687wmi.15.1694787657790; Fri, 15 Sep 2023 07:20:57 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:a63c:a2c3:ab34:f429]) by smtp.gmail.com with ESMTPSA id m13-20020a7bca4d000000b003fe4548188bsm7656828wml.48.2023.09.15.07.20.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 07:20:57 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Fix internal error on aggregate nested in container aggregate Date: Fri, 15 Sep 2023 16:20:56 +0200 Message-Id: <20230915142056.2100936-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 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.30 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: INBOX X-GMAIL-THRID: 1777113783893500022 X-GMAIL-MSGID: 1777113783893500022 From: Eric Botcazou 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. 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 cdca24b7d5d..d72e27030e5 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -4251,9 +4251,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) @@ -6122,10 +6124,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