aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2024-01-04 17:37:06 +0100
committerMarc Poulhiès <poulhies@adacore.com>2024-05-06 11:11:32 +0200
commitec1cdad89afed4d5fc8617c3de3c1950ca55ba7e (patch)
treec795a9d90e300427ca20efc77b1dc15e801e7f1b /gcc/ada
parentd917954922f38652eb314f096e130ecaa53e8441 (diff)
downloadgcc-ec1cdad89afed4d5fc8617c3de3c1950ca55ba7e.zip
gcc-ec1cdad89afed4d5fc8617c3de3c1950ca55ba7e.tar.gz
gcc-ec1cdad89afed4d5fc8617c3de3c1950ca55ba7e.tar.bz2
ada: Allow use of writable parameters inside function with side-effects
Writable parameters can be used as global outputs inside functions with side-effects. gcc/ada/ * sem_prag.adb (Collect_Global_Item): Handle functions with side-effects.
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/sem_prag.adb5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 25a98cb..5764992 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -31656,8 +31656,9 @@ package body Sem_Prag is
-- outputs when the related type is access-to-variable.
if Ekind (Formal) = E_In_Parameter
- and then Ekind (Spec_Id) not in E_Function
- | E_Generic_Function
+ and then (Ekind (Spec_Id) not in E_Function
+ | E_Generic_Function
+ or else Is_Function_With_Side_Effects (Spec_Id))
and then Is_Access_Variable (Etype (Formal))
then
Append_New_Elmt (Formal, Subp_Outputs);