* [Ada] Propagate Ghost status from parent to derived subprograms
@ 2021-10-05 8:26 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-10-05 8:26 UTC (permalink / raw)
To: gcc-patches; +Cc: Piotr Trojanek
[-- Attachment #1: Type: text/plain, Size: 303 bytes --]
When creating the entity of a derived subprogram we copy all kinds of
properties from the parent, but we failed to copy the ghost status of
the entity.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* sem_ch3.adb (Derive_Subprogram): Copy ghost status from parent
to derived subprogram.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 795 bytes --]
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -16111,6 +16111,14 @@ package body Sem_Ch3 is
Set_No_Return (New_Subp, No_Return (Parent_Subp));
+ -- If the parent subprogram is marked as Ghost, then so is the derived
+ -- subprogram. The ghost policy for the derived subprogram is set from
+ -- the effective ghost policy at the point of derived type declaration.
+
+ if Is_Ghost_Entity (Parent_Subp) then
+ Set_Is_Ghost_Entity (New_Subp);
+ end if;
+
-- A derived function with a controlling result is abstract. If the
-- Derived_Type is a nonabstract formal generic derived type, then
-- inherited operations are not abstract: the required check is done at
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-10-05 8:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-05 8:26 [Ada] Propagate Ghost status from parent to derived subprograms 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).