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 r12-1522] [Ada] Ignore volatile restrictions in preanalysis Date: Wed, 16 Jun 2021 08:46:15 +0000 (GMT) [thread overview] Message-ID: <20210616084615.01DEB3943413@sourceware.org> (raw) https://gcc.gnu.org/g:1a9ff8d39c1f5a63755f2a8bb0a982c7af4ee817 commit r12-1522-g1a9ff8d39c1f5a63755f2a8bb0a982c7af4ee817 Author: Piotr Trojanek <trojanek@adacore.com> Date: Wed Mar 3 20:15:56 2021 +0100 [Ada] Ignore volatile restrictions in preanalysis gcc/ada/ * sem_util.adb (Is_OK_Volatile_Context): All references to volatile objects are legal in preanalysis. (Within_Volatile_Function): Previously it was wrongly called on Empty entities; now it is only called on E_Return_Statement, which allow the body to be greatly simplified. Diff: --- gcc/ada/sem_util.adb | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 68e9a089eaf..6376b4e6b62 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -18871,27 +18871,14 @@ package body Sem_Util is ------------------------------ function Within_Volatile_Function (Id : Entity_Id) return Boolean is - Func_Id : Entity_Id; + pragma Assert (Ekind (Id) = E_Return_Statement); - begin - -- Traverse the scope stack looking for a [generic] function - - Func_Id := Id; - while Present (Func_Id) and then Func_Id /= Standard_Standard loop - if Ekind (Func_Id) in E_Function | E_Generic_Function then - - -- ??? This routine could just use Return_Applies_To, but it - -- is currently wrongly called by unanalyzed return statements - -- coming from expression functions. - pragma Assert (Func_Id = Return_Applies_To (Id)); + Func_Id : constant Entity_Id := Return_Applies_To (Id); - return Is_Volatile_Function (Func_Id); - end if; - - Func_Id := Scope (Func_Id); - end loop; + begin + pragma Assert (Ekind (Func_Id) in E_Function | E_Generic_Function); - return False; + return Is_Volatile_Function (Func_Id); end Within_Volatile_Function; -- Local variables @@ -18901,6 +18888,15 @@ package body Sem_Util is -- Start of processing for Is_OK_Volatile_Context begin + -- Ignore context restriction when doing preanalysis, e.g. on a copy of + -- an expression function, because this copy is not fully decorated and + -- it is not possible to reliably decide the legality of the context. + -- Any violations will be reported anyway when doing the full analysis. + + if not Full_Analysis then + return True; + end if; + -- For actual parameters within explicit parameter associations switch -- the context to the corresponding subprogram call.
reply other threads:[~2021-06-16 8:46 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=20210616084615.01DEB3943413@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).