From patchwork Tue Jan 3 09:35:14 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: 38330 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4523722wrt; Tue, 3 Jan 2023 01:36:28 -0800 (PST) X-Google-Smtp-Source: AMrXdXvGYiGj2HPt0MG6t+JwhLsNlqAE6gtKzMmV4LVe5GsKjX3Uw0s8/OKdRoL+6A9At3/O2Ur4 X-Received: by 2002:aa7:d601:0:b0:483:87cb:a5df with SMTP id c1-20020aa7d601000000b0048387cba5dfmr25266004edr.30.1672738588266; Tue, 03 Jan 2023 01:36:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672738588; cv=none; d=google.com; s=arc-20160816; b=Tlf++fhsNEPaBEgmeouTGDP5P2OoZliiygUgTR/juDXTZoXxonyQA1M2Q5OwTiQDwf 21fip7ZKxe4F7d8NdspjetdFE3kG7S4fc4JD53yw/Ilew6JoW/3tdapkDBPADJuZuB8M w/GIJet4xTsm320+GmDibPI3Uz1cyKs99DMs0N2hVHhxI35yTFnD2VcRQRQp3wNwiMO7 N7xolcdWPPgqjuly87qQXeU0FcJOsNmlmMsWVJzw5OfSO7S4bb7vtLwcIjtWiUry/11v kp6dv0Y9+QnBD0ReyaK517axUlBY894VRLEEDvh++ZK746iJi1Sudoy5AaILvoGZbF6b /FOQ== 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:delivered-to:dkim-signature:dkim-filter; bh=899bdIrNp/rFlJOPK8/z19MaUvkdksU22swNbePq1SM=; b=XDwd2OfdPzwkE1PPgxlqQcvMnEP8dV2ezH+t69Tv7Z/MSuqnorIvNh/GPtvn4tYlj0 jZ//GhyenQJql/x/Ym8bxGNOV7oOyztC5qnjQ9IxZcWJJ+f1NaaXy0UFbhYvHo2lwVDm QL4nPFh6YYWEVR2JsBTYGkaFm6hd6ZoIhN03yd5mt9Z4rTHFo57SYiqEWfXjhlXXwj1H 8yd2furGTCC4ZUSVptf6w1BQfCimz630Csm79jIcmiL2331467OaBRmlAPSLxZKNBtdf 3bEYv5HMFLiCmVq1HnusGUbF3NWkkHJDZ92OJQ5KiMBw3cZa9t2gw7KWqgJH3lZGNPCY 39IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=sQVBVk1M; 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 sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id c16-20020a05640227d000b004676b7d42d7si31399004ede.243.2023.01.03.01.36.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jan 2023 01:36:28 -0800 (PST) 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=sQVBVk1M; 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 2A79B3858005 for ; Tue, 3 Jan 2023 09:36:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2A79B3858005 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672738565; bh=899bdIrNp/rFlJOPK8/z19MaUvkdksU22swNbePq1SM=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=sQVBVk1McFCB7kxa3CSJ1IPR+C3zGCJ3nSOd8xB2kehSBDK32i4tyGl73Xsk/wkR5 vGiiO8DwVbu3/NGAl25dGVSlh9SN4/RgFEW0eX8PsVw3okVRzZz7qyFsLwoeFadoFJ jac5WqmwewkMwSJsssV7ZEec6IpbVSQLx/0vHiQw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id 7D8A03858C2B for ; Tue, 3 Jan 2023 09:35:18 +0000 (GMT) Received: by mail-wr1-x42c.google.com with SMTP id d9so266004wrp.10 for ; Tue, 03 Jan 2023 01:35:18 -0800 (PST) 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=899bdIrNp/rFlJOPK8/z19MaUvkdksU22swNbePq1SM=; b=hs/1ie5O1EgsuvxqFymUcyt7ewjzs+L9J4p/ql33d+KrndA6Hm+SLBI9G3LOijbJhT nvM/QkCuRkH4Mpov1zw0vQGq+uRS1wTSEl04HrZasdjcWIGzygNExNwQWJp/t49eHFFd uWFJlk9OIcCa65JWbeaDuVh8kpU72weowQvPLxISdcJ9lZMeWhxLIZrW881m8vBLjlqc LdVSKmG6ESD+VKU3m1QTCFoemYQP+odgoG6UkHqNmujud/3HvjiRl1rRfu0+x/SfgLnF j58Xq+6d3xQGiDxeFWqjR9jxoEQy79dD6WSkNF2INqOza7lzxScCP3Dy/IPKlFegUlp8 zEhA== X-Gm-Message-State: AFqh2kogVRMQ4ND8+S/X+/DTLORWVSROCu3EkytkH/ZP8wwhrwYQKRE/ acEUMc5x4KO77DZcFuC6z5fLnJi444KDQJimFmo= X-Received: by 2002:adf:d4c7:0:b0:253:4e9a:a81d with SMTP id w7-20020adfd4c7000000b002534e9aa81dmr26704578wrk.35.1672738517338; Tue, 03 Jan 2023 01:35:17 -0800 (PST) Received: from localhost.localdomain (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id p3-20020adfcc83000000b0027a57c1a6fbsm25074855wrj.22.2023.01.03.01.35.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jan 2023 01:35:16 -0800 (PST) To: gcc-patches@gcc.gnu.org Cc: Javier Miranda Subject: [COMMITTED] ada: Cannot reference ghost entity in class-wide precondition Date: Tue, 3 Jan 2023 10:35:14 +0100 Message-Id: <20230103093514.76112-1-poulhies@adacore.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 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?= 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?1753993538248132330?= X-GMAIL-MSGID: =?utf-8?q?1753993538248132330?= From: Javier Miranda gcc/ada/ * ghost.adb (Is_OK_Declaration): A reference to a Ghost entity may appear within the class-wide precondition of a helper subprogram. This context is treated as suitable because it was already verified when we were analyzing the original class-wide precondition. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/ghost.adb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gcc/ada/ghost.adb b/gcc/ada/ghost.adb index 0f03285b024..0d2a23dc042 100644 --- a/gcc/ada/ghost.adb +++ b/gcc/ada/ghost.adb @@ -261,6 +261,16 @@ package body Ghost is then return True; + -- A reference to a Ghost entity may appear within the class-wide + -- precondition of a helper subprogram. This context is treated + -- as suitable because it was already verified when we were + -- analyzing the original class-wide precondition. + + elsif Is_Subprogram (Current_Scope) + and then Present (Class_Preconditions_Subprogram (Current_Scope)) + then + return True; + -- References to Ghost entities may be relocated in internally -- generated bodies.