public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Marc Poulhi?s <dkm@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-1274] ada: Fix handling of Global contracts inside generic subprograms Date: Fri, 26 May 2023 07:36:44 +0000 (GMT) [thread overview] Message-ID: <20230526073644.5D3173858C54@sourceware.org> (raw) https://gcc.gnu.org/g:fd3eff65551876a04febca1621d7d19f9390aab6 commit r14-1274-gfd3eff65551876a04febca1621d7d19f9390aab6 Author: Piotr Trojanek <trojanek@adacore.com> Date: Tue Oct 5 15:29:44 2021 +0200 ada: Fix handling of Global contracts inside generic subprograms Routine Get_Argument works differently for generic units (as explained in its comment), but it failed to reliably detect such units when their kind is temporarily made non-generic (for resolving recursive calls, as explained in the comment at the end of Is_Generic_Declaration_Or_Body). With this patch the frontend will look at the decorated expression of the Global contract attached to the Global aspect; previously it was looking at the undecorated expression attached to the corresponding pragma. gcc/ada/ * sem_prag.adb (Get_Argument): Improve detection of generic units. Diff: --- gcc/ada/sem_prag.adb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index d66e5612135..96ea17209f3 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -31650,7 +31650,9 @@ package body Sem_Prag is -- to save the global references in the generic context. if From_Aspect_Specification (Prag) - and then (Present (Context_Id) and then Is_Generic_Unit (Context_Id)) + and then Present (Context_Id) + and then + Is_Generic_Declaration_Or_Body (Unit_Declaration_Node (Context_Id)) then return Corresponding_Aspect (Prag);
reply other threads:[~2023-05-26 7:36 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230526073644.5D3173858C54@sourceware.org \ --to=dkm@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).