]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Adapt SPARK RM rule on non-effectively volatile abstract state
authorYannick Moy <moy@adacore.com>
Fri, 30 Apr 2021 10:41:22 +0000 (12:41 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 5 Jul 2021 13:09:16 +0000 (13:09 +0000)
gcc/ada/

* sem_prag.adb (Analyze_Global_Item): Adapt to update SPARK RM
rule.

gcc/ada/sem_prag.adb

index fa63fdae7300d3cd54ea68736b383eb8a60b875a..0efdceff5e72a85741546181c74f4c3686c2bbca 100644 (file)
@@ -2433,10 +2433,13 @@ package body Sem_Prag is
                      SPARK_Msg_N ("\use its constituents instead", Item);
                      return;
 
-                  --  An external state cannot appear as a global item of a
-                  --  nonvolatile function (SPARK RM 7.1.3(8)).
+                  --  An external state which has Async_Writers or
+                  --  Effective_Reads enabled cannot appear as a global item
+                  --  of a nonvolatile function (SPARK RM 7.1.3(8)).
 
                   elsif Is_External_State (Item_Id)
+                    and then (Async_Writers_Enabled (Item_Id)
+                               or else Effective_Reads_Enabled (Item_Id))
                     and then Ekind (Spec_Id) in E_Function | E_Generic_Function
                     and then not Is_Volatile_Function (Spec_Id)
                   then