From patchwork Mon May 29 08:29:08 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: 100155 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1364388vqr; Mon, 29 May 2023 01:40:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6oJGGLUYPfJVHcJyFNZJwADxLpFSACov25FhFnRW0O7q5QK2bxv43HzaBD4xRqVQqrNA9o X-Received: by 2002:aa7:c486:0:b0:50b:d755:8acc with SMTP id m6-20020aa7c486000000b0050bd7558accmr7096504edq.34.1685349614512; Mon, 29 May 2023 01:40:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685349614; cv=none; d=google.com; s=arc-20160816; b=as1YlhWqQBPTsM8T5gL5hxkLTUOrVcA2rok664GblyZEJNsLJSrA7ptnyJqsTfrLYv 3ZFdOj4WGwJhZc/VNqEhqeoNla83Q3h1xfkEKCbB5FNHL2QPUdIduKHXwQwY923o0w/e 5f60OGxiC5GUjrkabwz8sjIjGfj8C01Ugn2iEyUUUW/Ea7vuv9k44QJd8vOOTT0lwhsj 6ZUsATbYRE98Z2piiu79MpWqpjeuDfWXDJbVYcrvttpNKYFe3jTUkUKgQky/0P7oUxbf aK8sYyEI6s3eh+S7sQzVsX/5mK64CKdKMFB09Gt2L4XMJRN/hDP0WijNzteTZ4WkQ8S7 5baA== 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=s1KE5CBhy1dHJ1NdSuv7mIBVhFOYkPygwc1jahtM/3M=; b=B3pyWx/n/vHCdGpDeUr0XoflsXB3C1+Wo5r63NMh8ME0razsz5+fYU8YYmY5qxdXkr F6hWISyEIyai2zPHBqVPK1qtaK6587BSkYK7z7dI/KJkZgtOLN4SeC/M6TTn0IELnQQH H8WJH5zcA51nOb7WVpaF91V7Z68DBjhdVk8xDkr/dqqngXnchmXQX0VjyWUAAHX39oS3 yMqgNKFvs8FXL50t/JgEnDfd5+H0HvXAe4ekHupn2jd8RP4L+vptHuiEimTD59QFNWtR xZn0Mgvvpz8gIzj5MkgP7QaVSKrndFVF6xCjmYiVtkw2M+Vo4fI5GBt2KLkrbQZf+hfR Yl6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ugQwhfhI; 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 c5-20020a056402120500b00514a495a035si365633edw.692.2023.05.29.01.40.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 May 2023 01:40:14 -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=ugQwhfhI; 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 9119F3882646 for ; Mon, 29 May 2023 08:35:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9119F3882646 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685349309; bh=s1KE5CBhy1dHJ1NdSuv7mIBVhFOYkPygwc1jahtM/3M=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=ugQwhfhIgmrd32ucZ5RgFL7M0PhgmDG4tkx1yryQmNftrhfTUGnFjwo5xUCONkBWT jYjCfVZOvXqKxhkHfxzouaml5z5eQAJuYDTE10uOC6ukH1lmvypwSBG2enhrZFrGPE dLjBMiDZx2mpU2E15wHnOgX+wOk49X0UqhMeBgKk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id 359953857028 for ; Mon, 29 May 2023 08:29:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 359953857028 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-30ae7cc0e86so1022664f8f.1 for ; Mon, 29 May 2023 01:29:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685348950; x=1687940950; 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=s1KE5CBhy1dHJ1NdSuv7mIBVhFOYkPygwc1jahtM/3M=; b=HIZAVhKfef+7N881SlThj9RXZyy9WcucDoX4P13Xa3jvEpuwHJ1eH/bhgaIW6FVNcv Thv84QlgbgrUNu+D/pYVXiP2YR+Xwv0VIXaxHZGnuDHTkXTXbteXyR85IhRe8V+RX8JI D/GRpQRU6lfVYfk5OllCHfoCksiGZ+2Dp4I6efI3Rdkse2kwhNBK8Bqd0N0eG9bALHU1 n73mtczVoTB6RhJnyFBQj2vfjnHbUwLGQVUlzzCJpnu1XnXgM0Dz7KTXrSzxJRxjZJhH 8OC34kxk9Pf8gUZe/AfAbq5YlWRIyIAwe741Sky5HwHoL9bqOHj61PSFanuZn+ETQqTb ba9w== X-Gm-Message-State: AC+VfDwXwGjNzKgCO2tsLkWnx+ovaOnPUE+QktEDkfs4GMiP9PC2cBbu MtKhE0ga6omTjfkBCUno84XBCkYBQK6PNKXz6+oZ3w== X-Received: by 2002:a5d:6051:0:b0:30a:e09d:572d with SMTP id j17-20020a5d6051000000b0030ae09d572dmr6662198wrt.32.1685348950048; Mon, 29 May 2023 01:29:10 -0700 (PDT) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id o4-20020a5d4744000000b003062675d4c9sm12968528wrs.39.2023.05.29.01.29.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 May 2023 01:29:09 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Restore parent link for both lists and nodes in class-wide condition Date: Mon, 29 May 2023 10:29:08 +0200 Message-Id: <20230529082908.2409640-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?1767217157333501652?= X-GMAIL-MSGID: =?utf-8?q?1767217157333501652?= From: Piotr Trojanek When preanalysing class-wide conditions, we restore "Function (Object)" to its original "Object.Function" notation. This requires the Parent links to be fixed. We did it for nodes; now we do it for lists as well. This patch is enough to fix assertion failure in CCG and to make the tree well-connected. Perhaps there is a more elegant solution, but that remains to be investigated. gcc/ada/ * contracts.adb (Fix_Parent): Fir part both for lists and nodes. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/contracts.adb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb index 65f341abc8f..15b65ee4c06 100644 --- a/gcc/ada/contracts.adb +++ b/gcc/ada/contracts.adb @@ -4936,9 +4936,11 @@ package body Contracts is begin if Par /= Parent_Node then - pragma Assert (not Is_List_Member (Node) - or else Nkind (Par) = N_Function_Call); - Set_Parent (Node, Parent_Node); + if Is_List_Member (Node) then + Set_List_Parent (List_Containing (Node), Parent_Node); + else + Set_Parent (Node, Parent_Node); + end if; end if; return OK;