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-1569] [Ada] Reject allocators in contexts restricted by SPARK Date: Thu, 17 Jun 2021 14:32:53 +0000 (GMT) [thread overview] Message-ID: <20210617143253.8B2173857431@sourceware.org> (raw) https://gcc.gnu.org/g:02e9e5fb97a0342e370ea7ec0fff519b42edf097 commit r12-1569-g02e9e5fb97a0342e370ea7ec0fff519b42edf097 Author: Piotr Trojanek <trojanek@adacore.com> Date: Wed Mar 3 23:18:01 2021 +0100 [Ada] Reject allocators in contexts restricted by SPARK gcc/ada/ * sem_ch4.adb (Analyze_Allocator): Reject allocators in restricted contexts. Diff: --- gcc/ada/sem_ch4.adb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index d8498343157..ede257b6d40 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -889,6 +889,16 @@ package body Sem_Ch4 is Check_Restriction (No_Local_Allocators, N); end if; + if SPARK_Mode = On + and then Comes_From_Source (N) + and then not Is_OK_Volatile_Context (Context => Parent (N), + Obj_Ref => N, + Check_Actuals => False) + then + Error_Msg_N + ("allocator cannot appear in this context (SPARK RM 7.1.3(10))", N); + end if; + if Serious_Errors_Detected > Sav_Errs then Set_Error_Posted (N); Set_Etype (N, Any_Type);
reply other threads:[~2021-06-17 14:32 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=20210617143253.8B2173857431@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).