* [COMMITTED] ada: Fix ghost policy in use for generic instantiation
@ 2024-05-14 8:23 Marc Poulhiès
0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2024-05-14 8:23 UTC (permalink / raw)
To: gcc-patches; +Cc: Yannick Moy
From: Yannick Moy <moy@adacore.com>
The Ghost assertion policy relevant for analyzing a generic instantiation
is the Ghost policy at the point of instantiation, not the one applicable
for the generic itself.
gcc/ada/
* ghost.adb (Mark_And_Set_Ghost_Instantiation): Fix the current
Ghost policy for the instantiation.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/ghost.adb | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/gcc/ada/ghost.adb b/gcc/ada/ghost.adb
index 14951a031d9..677089039e8 100644
--- a/gcc/ada/ghost.adb
+++ b/gcc/ada/ghost.adb
@@ -1734,13 +1734,17 @@ package body Ghost is
elsif Ghost_Mode = Ignore then
Policy := Name_Ignore;
- -- Inherit the "ghostness" of the generic unit
+ -- Inherit the "ghostness" of the generic unit, but the current Ghost
+ -- policy is the relevant one for the instantiation.
- elsif Is_Checked_Ghost_Entity (Gen_Id) then
- Policy := Name_Check;
+ elsif Is_Checked_Ghost_Entity (Gen_Id)
+ or else Is_Ignored_Ghost_Entity (Gen_Id)
+ then
+ Policy := Policy_In_Effect (Name_Ghost);
- elsif Is_Ignored_Ghost_Entity (Gen_Id) then
- Policy := Name_Ignore;
+ if Policy = No_Name then
+ Policy := Name_Ignore;
+ end if;
end if;
-- Mark the instantiation as Ghost
--
2.43.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-14 8:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-14 8:23 [COMMITTED] ada: Fix ghost policy in use for generic instantiation 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).