From patchwork Tue Nov 8 08:43:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 16952 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2574722wru; Tue, 8 Nov 2022 00:57:25 -0800 (PST) X-Google-Smtp-Source: AMsMyM5mb2bLxw3KMTOmxIljP3OVzaE2ExdTul0KArxz9WTXmKgjgL+hhy4GpRIJ0qelDJH7f1Zo X-Received: by 2002:aa7:d7c1:0:b0:463:1dcc:5fbc with SMTP id e1-20020aa7d7c1000000b004631dcc5fbcmr51102712eds.250.1667897845787; Tue, 08 Nov 2022 00:57:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667897845; cv=none; d=google.com; s=arc-20160816; b=r9sVVJkPCOO63I9kXyB7QO/gysZKanoQ+43iEsPFxhryxoCZpdACZwZBeqeYpxdvkl upM5HB3y5x/ly8WYE5mOpwNziDeSK3HIi9JIjkUx7rFIM5F6I0Fi9T7bLgQU6UJlkYEO M6ssQSAhRexyVzhhBnV71OlL7PQyFy9m8BeQrTcZrGYG2av6S4HcaP49vRiWoeAnf3oo VL/Ce96e4D9AFQTyq/1I7y0RZ5ACIZ0L6PlTCtm8wNFXwwMYP6gVXVi0QYLEq/nGFYh+ XYA2YSa49J0nxsigDww+7VevsONcAG/V1R9MZW5rpALigHC/KHjNus3lqn0Yld8wBedU 2HuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=BG2FugsOghidolr08Z1Tsb1P5GiNMzzj0rv3Us533/M=; b=Mw3oOIJ53p1l22z0MVKjO7heBiQfMLg6b3gFJcelE9G+7Qm0uaFshWq7R9p5XT/sDT fUnORE5LjuT7a7OOoRvplCAHIscZCptKTgPTh+BLuqOUvl34AMDuUcDjVETVCU4DhLgH PKWOnXH4AKobaZsE+X9eoEMTVFTJwTTnxnTEfg1h4LWBOlbR7IFL1OT/GXxDWcQ1Ce9n ePjFPkM55jWjGAAujU7dMOWDPAz1WFIXrDZbSyPFXrNZHlIBoevTFkNzYdbEtMv3wNFx qK3IafGV1beVio3HH6DtxN/fwdaiN2ZRRlz0vuwQoAl67BHG8peUdV6dov2jP0E7C3Se lbCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=hqeemcsd; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id s20-20020aa7d794000000b00461cdda451dsi10342924edq.435.2022.11.08.00.57.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Nov 2022 00:57:25 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=hqeemcsd; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1EAF43851ABE for ; Tue, 8 Nov 2022 08:52:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1EAF43851ABE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667897533; bh=BG2FugsOghidolr08Z1Tsb1P5GiNMzzj0rv3Us533/M=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=hqeemcsdWwdxnsfv4Nblcu11qkGOiI2l/0+9rV9U69QWi04waH3rQ0gDg6zoEDd39 errdY9sEwkmqM/t+WmsWyEpKjECuU37+sbw8+sidUShEkWxZofa4b8vKlLa2+grKEe 4kxwEY4Naxc2y+gLDVrvyh8ITmxJ/6a8VzhXwHoQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 Received: by mail-wr1-x42b.google.com with SMTP id g12so19739255wrs.10 for ; Tue, 08 Nov 2022 00:43:26 -0800 (PST) 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-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) 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 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: =?utf-8?q?Marc_Poulhi=C3=A8s?= Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748917651547788376?= X-GMAIL-MSGID: =?utf-8?q?1748917651547788376?= 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));