From patchwork Tue Oct 5 08:26:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 1536527 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=B+ggOlbb; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HNrSc1zR7z9sPB for ; Tue, 5 Oct 2021 19:33:04 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2F80B3857022 for ; Tue, 5 Oct 2021 08:33:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2F80B3857022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1633422782; bh=PGLntpiFLNJLoDqeruml60RXWK/KjUOqGpnjczAiMog=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=B+ggOlbb46+JN2PzS4VPJQThyvl3WDc+N8vtV1yMIyCHI3j9LZ9UMsTpTqs2Hb1Ck W9vuvBcsJohHe8AVDzz6APuisdIIR9l/0cLqFt2GqlgwQj0pDzmfGPqtcUgWWV6Bxk mkFcVJg7x4zZgJf3aAmFcZz2zzVlMEdKZtAMAIQM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by sourceware.org (Postfix) with ESMTPS id CB3AF3857C59 for ; Tue, 5 Oct 2021 08:26:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CB3AF3857C59 Received: by mail-lf1-x134.google.com with SMTP id x27so82286275lfa.9 for ; Tue, 05 Oct 2021 01:26:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=PGLntpiFLNJLoDqeruml60RXWK/KjUOqGpnjczAiMog=; b=PVsifzKja2U3a5nxk1gmGDHC3CdtcDn41xU5EdaSW7ZR1Fu/w7PMO3GExM7Gbw7kqf L39ylcajXD+182ToaUxw6oxXpBJ7EPtwqmxLBap+c0N4pfP43dTIrj33NlW9HAQ/XWJE 8L6bKkzauEG3jXAkkpPF2+OCx34Ck39xmI+8JitGCQlxfNwrlnXO1ZcilXX8WlSDlfT6 DcIAm/UOefn1VQ4dqSYhqYRIGiNEpqMwk369k2/LQ4c+Ou62M/4u9gDEz8J4QVamhHbE iHQitLXBQr6zPvghiObrQ22UuB4eOQCgbX5T90Dw28ZdN5RB6CxBLT2dzzw/edNW/kNn 1jsw== X-Gm-Message-State: AOAM530tMEZG5hMlopGkpxUOkzoIiJ/oBiGVuQDJiqiTwHh3Haz426TA Defi+KQ816o39/gRCfkiEwsDvG2ijWM= X-Google-Smtp-Source: ABdhPJzeUYjuWX6/YhZjuXPaFN6dbnge5ezeLsWt7GBCuZlykKGYcZkj/TlyNvd4qGQs5s03JQsFUQ== X-Received: by 2002:a19:dc59:: with SMTP id f25mr2222766lfj.414.1633422399682; Tue, 05 Oct 2021 01:26:39 -0700 (PDT) Received: from adacore.com ([2a02:2ab8:224:2ce:72b5:e8ff:feef:ee60]) by smtp.gmail.com with ESMTPSA id h10sm1869583lft.15.2021.10.05.01.26.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Oct 2021 01:26:38 -0700 (PDT) Date: Tue, 5 Oct 2021 08:26:37 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Propagate Ghost status from parent to derived subprograms Message-ID: <20211005082637.GA2693593@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.0 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Cc: Piotr Trojanek Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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. 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