* [COMMITTED] ada: Cannot reference ghost entity in class-wide precondition
@ 2023-01-03 9:35 Marc Poulhiès
0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2023-01-03 9:35 UTC (permalink / raw)
To: gcc-patches; +Cc: Javier Miranda
From: Javier Miranda <miranda@adacore.com>
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.
--
2.34.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-01-03 9:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-03 9:35 [COMMITTED] ada: Cannot reference ghost entity in class-wide precondition Marc Poulhiès
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).