public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Fix spurious errors on ghost code in generics
@ 2022-06-02  9:09 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-06-02  9:09 UTC (permalink / raw)
  To: gcc-patches; +Cc: Yannick Moy

[-- Attachment #1: Type: text/plain, Size: 386 bytes --]

After the recent fix for detecting illegal use of ghost entities in
code, spurious errors could be raised on generic code with ghost, due to
wrong setting of the ghost flags on copied entities from the generic to
the instantiation.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* atree.adb (New_Copy): Reset flags related to ghost entities
	before marking the new node.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 494 bytes --]

diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb
--- a/gcc/ada/atree.adb
+++ b/gcc/ada/atree.adb
@@ -1775,6 +1775,11 @@ package body Atree is
 
          --  Mark the copy as Ghost depending on the current Ghost region
 
+         if Nkind (New_Id) in N_Entity then
+            Set_Is_Checked_Ghost_Entity (New_Id, False);
+            Set_Is_Ignored_Ghost_Entity (New_Id, False);
+         end if;
+
          Mark_New_Ghost_Node (New_Id);
 
          New_Node_Debugging_Output (New_Id);



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-02  9:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-02  9:09 [Ada] Fix spurious errors on ghost code in generics Pierre-Marie de Rodat

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).