From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id C1F393857C6F for ; Tue, 8 Nov 2022 08:43:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C1F393857C6F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wr1-x42b.google.com with SMTP id g12so19739255wrs.10 for ; Tue, 08 Nov 2022 00:43:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=BG2FugsOghidolr08Z1Tsb1P5GiNMzzj0rv3Us533/M=; b=BbCBVhiS/+iAXtoW7GTo7qS38BFEWD2YE+CNbKS8r90RYxWd7N92uAw9S/1aLLO6xA zyTxPc5EKPnPOL1eqre8WTCWmS/CTeofG5/nX0kFWdfvc3uvHfrLIPfAyatsx74KV72z zb6Erm9ZhAC/fnbc6FgGwJe4GINcw8LFNw2MB3W38pa14+Adx4GzhwwIjmqp+VtRiM3L 8JasM8LNZA9u7SMC95GJRSGZuitrR+PrkPzi0YCnriersxM+N4cpA9SBLu+5neal8TjG VN02duMPUrGoNAzKSQNZamKki50Tku/qUsEnGhwCewBkS2uio60xtAg+SoSu9GnEPLfR 4oxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BG2FugsOghidolr08Z1Tsb1P5GiNMzzj0rv3Us533/M=; b=VIim+RVpRItFA9U73fFwHecCuBS8PYYf772IhcrBqTqRk59yz1/5khyMn3aKKfczH2 SFW/tUie51aLLEWWRVrmGU8zcj+saMr09xh8AaqEC+e/b3iNIiKOFN4zJwXbdpdoWs7y sIVrf8vvkASLUiVwCctfefTgMwUhacGJTYW94nDEaIdBB/TYRpBjhhffrGyNATpdDwjL bKh9t6La47ZJiyKb+ueqh5o5E87ODHV7i61fm2Z3bo/Cz52njSCMykEYYbsV6N4kZB4/ 0I01U5CBNPE8iN+Gkv4qXA37/EeA+rz44/lA+dJJWWWCe5ZDLGR8j8UhA9DUwtNb7VCK gfyQ== X-Gm-Message-State: ACrzQf0bLq390jKk1Im2dvXYM8HPk9Ivccn0lcTNxRGq59IMF90dyzUf EWCYjd5j1zEfCG213o6sXUT+anz7cBi3Lg== X-Google-Smtp-Source: AMsMyM50TzHTq8VCjKUEBM5jOjYLul9nlv/le4vO7wvL8Pmjfpdg6H9YF2CWd1UUtWZo2PTlbI1UdQ== X-Received: by 2002:adf:a2dc:0:b0:238:3e97:7901 with SMTP id t28-20020adfa2dc000000b002383e977901mr18211530wra.323.1667897005621; Tue, 08 Nov 2022 00:43:25 -0800 (PST) Received: from localhost.localdomain (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id l5-20020a1c7905000000b003cf6e1df4a8sm10155045wme.15.2022.11.08.00.43.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Nov 2022 00:43:25 -0800 (PST) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Propagate aspect Ghost when instantiating null formal procedures Date: Tue, 8 Nov 2022 09:43:21 +0100 Message-Id: <20221108084321.301906-1-poulhies@adacore.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Piotr Trojanek 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. Tested on x86_64-pc-linux-gnu, committed on master. --- 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)); -- 2.34.1