public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-1569] [Ada] Reject allocators in contexts restricted by SPARK
@ 2021-06-17 14:32 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-06-17 14:32 UTC (permalink / raw)
To: gcc-cvs
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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-17 14:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17 14:32 [gcc r12-1569] [Ada] Reject allocators in contexts restricted by SPARK Pierre-Marie de Rodat
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).