From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id 22B65398A85A; Wed, 16 Jun 2021 08:46:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 22B65398A85A 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 r12-1523] [Ada] Fix Is_Volatile_Function for functions declared in protected bodies X-Act-Checkin: gcc X-Git-Author: Piotr Trojanek X-Git-Refname: refs/heads/master X-Git-Oldrev: 1a9ff8d39c1f5a63755f2a8bb0a982c7af4ee817 X-Git-Newrev: ccf0dee109ba0c71ca2b6e093a874daf1671ecf0 Message-Id: <20210616084620.22B65398A85A@sourceware.org> Date: Wed, 16 Jun 2021 08:46:20 +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: Wed, 16 Jun 2021 08:46:20 -0000 https://gcc.gnu.org/g:ccf0dee109ba0c71ca2b6e093a874daf1671ecf0 commit r12-1523-gccf0dee109ba0c71ca2b6e093a874daf1671ecf0 Author: Piotr Trojanek Date: Wed Mar 3 21:19:39 2021 +0100 [Ada] Fix Is_Volatile_Function for functions declared in protected bodies gcc/ada/ * sem_util.adb (Is_Volatile_Function): Follow the exact wording of SPARK (regarding volatile functions) and Ada (regarding protected functions). Diff: --- gcc/ada/sem_util.adb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 6376b4e6b62..6481d86a835 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -21105,9 +21105,11 @@ package body Sem_Util is begin pragma Assert (Ekind (Func_Id) in E_Function | E_Generic_Function); - -- A function declared within a protected type is volatile + -- A protected function is volatile - if Is_Protected_Type (Scope (Func_Id)) then + if Nkind (Parent (Unit_Declaration_Node (Func_Id))) = + N_Protected_Definition + then return True; -- An instance of Ada.Unchecked_Conversion is a volatile function if