From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id 1CFB7385736C; Fri, 13 May 2022 08:07:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1CFB7385736C MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-385] [Ada] Accept effectively volatile components in actuals X-Act-Checkin: gcc X-Git-Author: Piotr Trojanek X-Git-Refname: refs/heads/master X-Git-Oldrev: 7427e673d818be052fd07468c9dfdad3dbfe13b3 X-Git-Newrev: 74ce1d5a6cbcf81e21b4c0eeee372df46c275df0 Message-Id: <20220513080725.1CFB7385736C@sourceware.org> Date: Fri, 13 May 2022 08:07:25 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2022 08:07:25 -0000 https://gcc.gnu.org/g:74ce1d5a6cbcf81e21b4c0eeee372df46c275df0 commit r13-385-g74ce1d5a6cbcf81e21b4c0eeee372df46c275df0 Author: Piotr Trojanek Date: Wed Feb 16 12:13:57 2022 +0100 [Ada] Accept effectively volatile components in actuals In SPARK we forbid names that are effectively volatile for reading if they occur in actual subprogram parameters. We wrongly rejected references to components, which are not names in Ada. gcc/ada/ * sem_res.adb (Flag_Effectively_Volatile_Objects): Ignore component and discriminant identifiers. Diff: --- gcc/ada/sem_res.adb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 4ae0835498b..4306e49ed76 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -3868,7 +3868,13 @@ package body Sem_Res is when N_Identifier | N_Expanded_Name => Id := Entity (N); + -- Identifiers of components and discriminants are not names + -- in the sense of Ada RM 4.1. They can only occur as a + -- selector_name in selected_component or as a choice in + -- component_association. + if Is_Object (Id) + and then Ekind (Id) not in E_Component | E_Discriminant and then Is_Effectively_Volatile_For_Reading (Id) and then not Is_OK_Volatile_Context (Context => Parent (N),