From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 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-wr1-x434.google.com with SMTP id bs21so7195867wrb.4 for ; Fri, 04 Nov 2022 06:59:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=4Tihec0MB8a+ZvgaPe1sLcrdtUyvy9NqpqjGo0/02YM=; b=EE0UYhLVupT+jWDZ/MW14Wch7/TQLD68eYyUvoskHUhryaEdiMeS5sqbcUqyvuMeOJ sMjP4u26t7zY0xwZS4yDtIVyKRlVQOf4EeQB5h8ZVtcNjuJKLc/wnIyrMmPXRnTiz3N8 HtdJD0Urd4349g7+n9nE1BPJpckopS2VinK8pwTX08Yn4vCGyN9bjTSiqdO0H5rsaj1W Aeu3Cjrvc1x8qFBSSa4f8k1f+mvTex5rkGtuUq+LwiSBs5YQI7iWnKXcjP6b+a64cYCN G/IEd5g0ZUQEeOGfjbGuZ4/8qo8vN4JSsfsooZVtToL8f5hW3q75oI3Wc7tpMl3vf2qt o87Q== 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-Google-Smtp-Source: AMsMyM4iejYMHKzjEr+esuRhZfE+CUCm+QDvQ3ZB3d7K99Ko1gA/7+ImocRXCeEDMhY6sKWN9SteBQ== 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) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou 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 Content-Transfer-Encoding: 8bit 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 List-Id: 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, -- 2.34.1