* [COMMITTED] ada: Allow use of writable parameters inside function with side-effects
@ 2024-05-06 9:18 Marc Poulhiès
0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2024-05-06 9:18 UTC (permalink / raw)
To: gcc-patches; +Cc: Piotr Trojanek
From: Piotr Trojanek <trojanek@adacore.com>
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.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/sem_prag.adb | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 25a98cb414e..5764992237b 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);
--
2.43.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-06 9:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-06 9:18 [COMMITTED] ada: Allow use of writable parameters inside function with side-effects Marc Poulhiès
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).