public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Marc Poulhi?s <dkm@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r15-202] ada: Allow use of writable parameters inside function with side-effects
Date: Mon,  6 May 2024 09:18:10 +0000 (GMT)	[thread overview]
Message-ID: <20240506091811.49A653858282@sourceware.org> (raw)

https://gcc.gnu.org/g:ec1cdad89afed4d5fc8617c3de3c1950ca55ba7e

commit r15-202-gec1cdad89afed4d5fc8617c3de3c1950ca55ba7e
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Thu Jan 4 17:37:06 2024 +0100

    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.

Diff:
---
 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);

                 reply	other threads:[~2024-05-06  9:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240506091811.49A653858282@sourceware.org \
    --to=dkm@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).