aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYannick Moy <moy@adacore.com>2021-04-30 12:41:22 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2021-07-05 13:09:16 +0000
commit902d7076663aff56198b81f8efa356c3e1024e80 (patch)
treec11d9bd441bd9be5a4be166bcc2a51fdc734b235
parent796b616383780e7707c21e4e31eb627e5937a93f (diff)
downloadgcc-902d7076663aff56198b81f8efa356c3e1024e80.zip
gcc-902d7076663aff56198b81f8efa356c3e1024e80.tar.gz
gcc-902d7076663aff56198b81f8efa356c3e1024e80.tar.bz2
[Ada] Adapt SPARK RM rule on non-effectively volatile abstract state
gcc/ada/ * sem_prag.adb (Analyze_Global_Item): Adapt to update SPARK RM rule.
-rw-r--r--gcc/ada/sem_prag.adb7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index fa63fda..0efdcef 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -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