From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7871) id 86A11385840C; Tue, 3 Jan 2023 09:33:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 86A11385840C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672738418; bh=AY6s3MmwzvK4DFQcTGORvf5CEsZklXjwOge/BvmtC54=; h=From:To:Subject:Date:From; b=UlVlh8WXTqPqIc9AC2rtmctXN3JvEwXFgBwK27b4B+JMVM/Iw92J/90bCTEql5NhB TTPlGtgj/O0WhKeLQ/yBLft2MW+ydx5TQXc+3s2lxh89ICKfPw31MestL/9OoRgp7X jt7JfxdbWOLPj/88Tqsd0YYmRPSq0cmYunSgbgJU= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Marc Poulhi?s To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-4959] ada: Cannot reference ghost entity in class-wide precondition X-Act-Checkin: gcc X-Git-Author: Javier Miranda X-Git-Refname: refs/heads/master X-Git-Oldrev: e1e2b0070302169fbf3f3fd95a13ec819e71e2a5 X-Git-Newrev: 930b81af5b0207585819ea9988a0f50d009940a7 Message-Id: <20230103093338.86A11385840C@sourceware.org> Date: Tue, 3 Jan 2023 09:33:38 +0000 (GMT) List-Id: https://gcc.gnu.org/g:930b81af5b0207585819ea9988a0f50d009940a7 commit r13-4959-g930b81af5b0207585819ea9988a0f50d009940a7 Author: Javier Miranda Date: Mon Nov 28 09:15:54 2022 +0000 ada: Cannot reference ghost entity in class-wide precondition 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. Diff: --- 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.