From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7871) id 60ABB3858283; Tue, 8 Nov 2022 08:41:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 60ABB3858283 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667896917; bh=PH4zrgd4iIQTpGtQKY1sLCQyCBOkVhID0xdw75KWiA8=; h=From:To:Subject:Date:From; b=JbjVaBTdL6Y4VUGBSp228nTn4TYxKve8rRV7QMWW3oGBxCh8xrxnfQD2EWA+hXalz n4XPlnqHssdZVSF64fzb1ig9QEt1PkZI3I1A2AGxYxqhBWMpsxI3UOGaUjN0jYFEYT QvgiwhxeQILIjvF96ua3mAq8+ebLhiA9GsPgb4i0= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Marc Poulhi?s To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3794] ada: Propagate aspect Ghost when instantiating null formal procedures X-Act-Checkin: gcc X-Git-Author: Piotr Trojanek X-Git-Refname: refs/heads/master X-Git-Oldrev: 59ad8b684dd67e171141761f520c6a2ec70e5d6c X-Git-Newrev: a645dc3c20c32ede1b5f50f1a35705ce87a3d61b Message-Id: <20221108084157.60ABB3858283@sourceware.org> Date: Tue, 8 Nov 2022 08:41:57 +0000 (GMT) List-Id: https://gcc.gnu.org/g:a645dc3c20c32ede1b5f50f1a35705ce87a3d61b commit r13-3794-ga645dc3c20c32ede1b5f50f1a35705ce87a3d61b Author: Piotr Trojanek Date: Fri Oct 21 20:12:15 2022 +0200 ada: Propagate aspect Ghost when instantiating null formal procedures When instantiating generic package that includes a formal subprogram declaration with Ghost aspect and a subprogram_default of null, e.g.: generic with procedure Proc is null with Ghost; package P is ... the Ghost aspect should be propagated to the internally generated null subprogram, so this null subprogram can be used in contexts that require ghost entities. gcc/ada/ * sem_ch12.adb (Instantiate_Formal_Subprogram): Copy aspect Ghost from formal subprogram declaration to the internally generated procedure. Diff: --- gcc/ada/sem_ch12.adb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index ca0f4913e36..276656085be 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -11088,6 +11088,8 @@ package body Sem_Ch12 is Set_Convention (Defining_Unit_Name (New_Spec), Convention_Intrinsic); + Copy_Ghost_Aspect (Formal, To => Decl_Node); + -- Eliminate the calls to it when optimization is enabled Set_Is_Inlined (Defining_Unit_Name (New_Spec));