From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by sourceware.org (Postfix) with ESMTPS id 9B8DB395561E for ; Thu, 2 Jun 2022 09:09:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9B8DB395561E Received: by mail-ed1-x533.google.com with SMTP id w27so5410504edl.7 for ; Thu, 02 Jun 2022 02:09:03 -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=Ezip4A8roLHSLcPPKBvmFBXUJJ4dKrBngQ+zBjcYIyA=; b=wk+4556BdP68A6bcBrOqwOPPwTMxHAIWs2mkfoR8mxuU6GbfH07yHpnakRvuCzJhYN s/qxBkFOncVXLKgjfkOg/Zge4od1yKBjrSeEBdvBZqne7dnFx5Jjk25Vbddezrn2FjqN RqdKVhvpQILR05HrwfYsWpJPsAk/0pygJXk2FO41jEANXypjqyc/lBLQ48ZrO/K7l54F bup2DlrwmJlx4t0f6nOoXsdFaMNJHnnaWcnBOxe5vH83zRAcrv0O8Uf6H6iSqlq7i+jh H/xx5/Sll7SpaVgpzOxEAEdtjoIoSPnjaFjI+BPLcHKyAfPox6lQNxGwk4OWXuK4iGx3 HrMg== X-Gm-Message-State: AOAM530QIS817RNwg3wAK7DvbZ1xT21smISoyi9yxjD/jhbWQPktrck2 vJO/Ha57Y3u0kMr7QQmAUTz1T/x0PsiPqw== X-Google-Smtp-Source: ABdhPJwYXZJky7LAGtMelyMrnHXvFN1fEK7YmOnprMRTYcj5iE1JEoyxz8dgTHOCPMFXgJ0+UEXofg== X-Received: by 2002:a05:6402:100c:b0:42d:f407:b050 with SMTP id c12-20020a056402100c00b0042df407b050mr4083165edu.39.1654160942325; Thu, 02 Jun 2022 02:09:02 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id x9-20020a1709064a8900b006f3ef214e2csm1591779eju.146.2022.06.02.02.09.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jun 2022 02:09:01 -0700 (PDT) Date: Thu, 2 Jun 2022 09:09:01 +0000 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Yannick Moy Subject: [Ada] Fix spurious errors on ghost code in generics Message-ID: <20220602090901.GA1010764@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="C7zPtVaVf+AK4Oqc" Content-Disposition: inline X-Spam-Status: No, score=-13.2 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, T_SCC_BODY_TEXT_LINE 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-List-Received-Date: Thu, 02 Jun 2022 09:09:05 -0000 --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline After the recent fix for detecting illegal use of ghost entities in code, spurious errors could be raised on generic code with ghost, due to wrong setting of the ghost flags on copied entities from the generic to the instantiation. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * atree.adb (New_Copy): Reset flags related to ghost entities before marking the new node. --C7zPtVaVf+AK4Oqc Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb --- a/gcc/ada/atree.adb +++ b/gcc/ada/atree.adb @@ -1775,6 +1775,11 @@ package body Atree is -- Mark the copy as Ghost depending on the current Ghost region + if Nkind (New_Id) in N_Entity then + Set_Is_Checked_Ghost_Entity (New_Id, False); + Set_Is_Ignored_Ghost_Entity (New_Id, False); + end if; + Mark_New_Ghost_Node (New_Id); New_Node_Debugging_Output (New_Id); --C7zPtVaVf+AK4Oqc--