From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7871) id 49A653858282; Mon, 6 May 2024 09:18:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 49A653858282 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1714987091; bh=Ai4t6Zw5Xsa+7zRc73p6/zNlg+LgyP2THCXu+fiN1mM=; h=From:To:Subject:Date:From; b=pTTqk7fHcHRwM0Nw7YcDp48EQKpqV97fPHn2BRnes73BWhFU8aaD2I5kMcXLRtSNO fF7gQWLeDaW1aGVhzUItOn+264/XiynX+P9YC/HClL9EG/rSLrLaG0Ag37QwIUDCNV nDcX9Bw+/259CeQ7pi3p6+9/QRBjCIZnoBRMwoZs= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Marc Poulhi?s To: gcc-cvs@gcc.gnu.org Subject: [gcc r15-202] ada: Allow use of writable parameters inside function with side-effects X-Act-Checkin: gcc X-Git-Author: Piotr Trojanek X-Git-Refname: refs/heads/master X-Git-Oldrev: d917954922f38652eb314f096e130ecaa53e8441 X-Git-Newrev: ec1cdad89afed4d5fc8617c3de3c1950ca55ba7e Message-Id: <20240506091811.49A653858282@sourceware.org> Date: Mon, 6 May 2024 09:18:10 +0000 (GMT) List-Id: https://gcc.gnu.org/g:ec1cdad89afed4d5fc8617c3de3c1950ca55ba7e commit r15-202-gec1cdad89afed4d5fc8617c3de3c1950ca55ba7e Author: Piotr Trojanek 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);