From: Piotr Trojanek Date: Fri, 10 Sep 2021 20:27:20 +0000 (+0200) Subject: [Ada] Propagate Ghost status from parent to derived subprograms X-Git-Tag: basepoints/gcc-13~4156 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc1fcd387984da9cde6d7314345d366789929d57;p=thirdparty%2Fgcc.git [Ada] Propagate Ghost status from parent to derived subprograms gcc/ada/ * sem_ch3.adb (Derive_Subprogram): Copy ghost status from parent to derived subprogram. --- diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index bf81f763faae..f1a56ad2b773 100644 --- 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