From patchwork Fri Nov 4 13:58:56 2022 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: 15561 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp426720wru; Fri, 4 Nov 2022 07:11:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76Uq8/a58lHBjIqtLzncV74W+p0/+U7Bz21di6RmKYJeKZpqGyLQw+ALI16rfv27Cx3pn8 X-Received: by 2002:a17:906:3ce9:b0:7ad:a030:487e with SMTP id d9-20020a1709063ce900b007ada030487emr326637ejh.508.1667571076224; Fri, 04 Nov 2022 07:11:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667571076; cv=none; d=google.com; s=arc-20160816; b=dJeYjiyySrVTFOavLYeC05/gVT72NCRCOi3YDvCOJF3EkustMJ4AkzvIlzscHylNi7 rXWjHXkMyJhjKnBZDvXXkarD+Plt+liFTGi7fuuJIiFPzyC6Nau/wjacVj7T5bvBe80D C2INbzd3Yb8+WKswrFjyhY0OttMT18vC+sy/fVRLY//E2pIwz/6H9XF1rl0gEqet1r3d kAMR5TbDhAJoxDEg3uqIoLeUe3OAet6WtXZhZwZdCLj8acrnIQ+5ZhbT7hkMWQv+j6W8 13DZKJQB8bJXDcotxi+5aR0tCT3RpjQGy9HwgEJQNz+wmuS6HoEiJr8AIcT6drJkMixZ Ui4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=4Tihec0MB8a+ZvgaPe1sLcrdtUyvy9NqpqjGo0/02YM=; b=t9cFLLnsUo9kPoRpWh0Tr/Q9RSpok6eK36zqidnY56Oun4YNTavwtvAkSRdX0P56lb NxX0h8jKFIVq5mXCXohIZQ5J4pCGaqkzSKI+rfl08Eu/jWt1oaHdRUXap4HVDJ4NxUwv qprHyNt/vdleyyynYEXEjQdTw6/9Vi9L8uMqc3s50j7NOYUOIEO2SYsBm/3EDQeCLIPe Fq4eUKcvcawAuZ3J98npxTpxakVzLGQLh7E+2ssS4bbg9LevPQ/sUcyHzT/WUsoXamP4 4x5ZPXOvJSZZSVefdM5paI66uHyFjrLA9tt4WpF6U1byQ2vJ615F0IAUuTzCAuxLYMSQ 7BwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=wWWgpQYX; 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 cr15-20020a170906d54f00b00782933fe436si5949567ejc.965.2022.11.04.07.11.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 07:11:16 -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=wWWgpQYX; 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 947A13856090 for ; Fri, 4 Nov 2022 14:03:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 947A13856090 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667570634; bh=4Tihec0MB8a+ZvgaPe1sLcrdtUyvy9NqpqjGo0/02YM=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=wWWgpQYXkvq5RBXJh0K6r/g5R4lG1hb8qqYKk6jaldQjTmn5MWuGqSmCFqIiTLlto G4aybO0S4Fo42/Q6gmPzQxfIXbaD7gv8fGxElyUYDOfVSQG78fouHfFgNVkuHD9B+R lVQljlJsxKuXOuVLCDWxcLtPGEwhVT8tqjGuDMYE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id 25DB73846440 for ; Fri, 4 Nov 2022 13:59:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 25DB73846440 Received: by mail-wr1-x434.google.com with SMTP id bs21so7195867wrb.4 for ; Fri, 04 Nov 2022 06:59:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=4Tihec0MB8a+ZvgaPe1sLcrdtUyvy9NqpqjGo0/02YM=; b=t+sA3KbOHtFzL01ivY05bPIc1gBAtLDmrMJQehJly1D6PlUHI6m+60/qCqR4wK5GU3 /YMjBGOwPiwdOoa7QQQeUxm47v247tehHlRdbNghXlaQe3uV1gwVzr1hFQaEnuBwk0tu orSczheVUt+dFD7H63nDvrhOwXNven0d/6HU9IltN1EKEcq4jRv/cjL4brm8RUpyxoG7 jHYyuYW/+Kh8ib0fjqj9mxgQMvwTcs3Whp+she+BFMOhzFCbxfIJBU27iL6kOZzgq4QA IRkXZ+CPLfx8/AzQ7rNTWXPB+m1nmZoZ1dFVQ4jXWOJqLqvYdzIZVqAFMenkWXEruIKk vZ9Q== X-Gm-Message-State: ACrzQf3BkAiKYWE2Xyp+zzz5eEIaeJAvxl/UVRyJeJBESlpxIOveFFQR rIwzKkRLCBydvjbCHIgP1vGMaDE9IU73ig== X-Received: by 2002:a5d:4a86:0:b0:236:cae3:e9ca with SMTP id o6-20020a5d4a86000000b00236cae3e9camr17466355wrq.201.1667570340968; Fri, 04 Nov 2022 06:59:00 -0700 (PDT) Received: from localhost.localdomain (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id bg27-20020a05600c3c9b00b003a5f3f5883dsm3462828wmb.17.2022.11.04.06.59.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 06:59:00 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [COMMITTED] ada: Fix couple of issues with arrays indexed by enumeration type Date: Fri, 4 Nov 2022 14:58:56 +0100 Message-Id: <20221104135856.87236-1-poulhies@adacore.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-13.3 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.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?= Cc: Eric Botcazou 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?1748575008949879390?= X-GMAIL-MSGID: =?utf-8?q?1748575008949879390?= From: Eric Botcazou The first one is that Remove_Warning_Messages reinstates the Original_Node of an N_Raise_Constraint_Error node in the tree for no clear reasons, and the Original_Node may contain constructs whose expansion has been stopped when the Constraint_Error was asserted, eventually causing gigi to stop. The second one is that a path in Build_Array_Aggr_Code.Gen_Loop does not copy the loop bounds, unlike other paths, thus triggering a sharing issue. gcc/ada/ * errout.adb (Remove_Warning_Messages.Check_For_Warning): Do not reinstate the Original_Node in the tree. * exp_aggr.adb (Build_Array_Aggr_Code.Gen_Loop): Copy the bounds on all paths. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/errout.adb | 16 +++------------- gcc/ada/exp_aggr.adb | 4 ++-- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb index 85931552970..5730a543ee1 100644 --- a/gcc/ada/errout.adb +++ b/gcc/ada/errout.adb @@ -3383,23 +3383,13 @@ package body Errout is E := Errors.Table (E).Next; end loop; + -- Warnings may have been posted on subexpressions of original tree + if Nkind (N) = N_Raise_Constraint_Error and then Is_Rewrite_Substitution (N) and then No (Condition (N)) then - -- Warnings may have been posted on subexpressions of the original - -- tree. We place the original node back on the tree to remove - -- those warnings, whose sloc do not match those of any node in - -- the current tree. Given that we are in unreachable code, this - -- modification to the tree is harmless. - - if Is_List_Member (N) then - Set_Condition (N, Original_Node (N)); - Check_All_Warnings (Condition (N)); - else - Rewrite (N, Original_Node (N)); - Check_All_Warnings (N); - end if; + Check_All_Warnings (Original_Node (N)); end if; return OK; diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 185705544e9..dde49d1e289 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -2058,7 +2058,7 @@ package body Exp_Aggr is -- to do that if we already have the base type at hand. if Etype (L) = Index_Base then - L_L := L; + L_L := New_Copy_Tree (L); else L_L := Make_Qualified_Expression (Loc, @@ -2067,7 +2067,7 @@ package body Exp_Aggr is end if; if Etype (H) = Index_Base then - L_H := H; + L_H := New_Copy_Tree (H); else L_H := Make_Qualified_Expression (Loc,