public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Attribute Address is not an interfering context in SPARK
@ 2021-05-07  9:38 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-05-07  9:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: Piotr Trojanek

[-- Attachment #1: Type: text/plain, Size: 248 bytes --]

Allow taking the address of a volatile object in SPARK, as it doesn't
cause problems related to interfering contexts.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* sem_res.adb (Flag_Object): Ignore prefixes of attribute
	Address.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 814 bytes --]

diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -3749,6 +3749,19 @@ package body Sem_Res is
 
          begin
             case Nkind (N) is
+
+               --  Do not consider object name appearing in the prefix of
+               --  attribute Address as a read.
+
+               when N_Attribute_Reference =>
+
+                  --  Prefix of attribute Address denotes an object, program
+                  --  unit, or label; none of them needs to be flagged here.
+
+                  if Attribute_Name (N) = Name_Address then
+                     return Skip;
+                  end if;
+
                --  Do not consider nested function calls because they have
                --  already been processed during their own resolution.
 



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-07  9:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07  9:38 [Ada] Attribute Address is not an interfering context in 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).