public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-485] [Ada] Accept calls to abstract subprograms in class-wide pre/post-conditions Date: Mon, 16 May 2022 08:43:47 +0000 (GMT) [thread overview] Message-ID: <20220516084347.74B1F3858C50@sourceware.org> (raw) https://gcc.gnu.org/g:e6bdaa0299d459e4f0486793bcbeff1bbe75f8a1 commit r13-485-ge6bdaa0299d459e4f0486793bcbeff1bbe75f8a1 Author: Javier Miranda <miranda@adacore.com> Date: Tue Mar 8 14:55:16 2022 -0800 [Ada] Accept calls to abstract subprograms in class-wide pre/post-conditions Fix a regression in the support for Ada 2022's treatment of calls to abstract subprograms in pre/post-conditions (thanks to Javier Miranda for producing this patch). gcc/ada/ * sem_disp.adb (Check_Dispatching_Context): When checking to see whether an expression occurs in a class-wide pre/post-condition, also check for the possibility that it occurs in a class-wide preconditions subprogram that was introduced as part of expansion. Without this fix, some legal calls occuring in class-wide preconditions may be incorrectly flagged as violating the "a call to an abstract subprogram must be dispatching" rule. Diff: --- gcc/ada/sem_disp.adb | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb index 2ab14439e94..0372ff87c33 100644 --- a/gcc/ada/sem_disp.adb +++ b/gcc/ada/sem_disp.adb @@ -751,14 +751,22 @@ package body Sem_Disp is elsif Is_Subprogram (Scop) and then not Is_Tag_Indeterminate (N) - and then In_Pre_Post_Condition (Call, Class_Wide_Only => True) + and then + -- The context is an internally built helper or an indirect + -- call wrapper that handles class-wide preconditions + (Present (Class_Preconditions_Subprogram (Scop)) - -- The tagged type associated with the called subprogram must be - -- the same as that of the subprogram with a class-wide aspect. + -- ... or the context is a class-wide pre/postcondition. + or else + (In_Pre_Post_Condition (Call, Class_Wide_Only => True) - and then Is_Dispatching_Operation (Scop) - and then - Find_Dispatching_Type (Subp) = Find_Dispatching_Type (Scop) + -- The tagged type associated with the called + -- subprogram must be the same as that of the + -- subprogram with a class-wide aspect. + + and then Is_Dispatching_Operation (Scop) + and then Find_Dispatching_Type (Subp) + = Find_Dispatching_Type (Scop))) then null;
reply other threads:[~2022-05-16 8:43 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=20220516084347.74B1F3858C50@sourceware.org \ --to=pmderodat@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).