From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id 73318385842F; Tue, 9 Nov 2021 09:45:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 73318385842F 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-5016] [Ada] Guard against illegal items in Global but not Depends X-Act-Checkin: gcc X-Git-Author: Piotr Trojanek X-Git-Refname: refs/heads/master X-Git-Oldrev: 74e514af79c4e01a6ff7fab4b7c7a79cad058c3c X-Git-Newrev: 9c8bb4d68240c2449c8ec9532f683cdad5bbbdbd Message-Id: <20211109094529.73318385842F@sourceware.org> Date: Tue, 9 Nov 2021 09:45:29 +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: Tue, 09 Nov 2021 09:45:29 -0000 https://gcc.gnu.org/g:9c8bb4d68240c2449c8ec9532f683cdad5bbbdbd commit r12-5016-g9c8bb4d68240c2449c8ec9532f683cdad5bbbdbd Author: Piotr Trojanek Date: Mon Oct 25 16:33:24 2021 +0200 [Ada] Guard against illegal items in Global but not Depends gcc/ada/ * sem_prag.adb (Check_Usage): Guard against calling Usage_Error with illegal Item_Id. The intention to do this was already described in the comment but not implemented. Diff: --- gcc/ada/sem_prag.adb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 10ad82fd8a4..1c048145bb4 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -1684,7 +1684,15 @@ package body Sem_Prag is -- States and global objects are not used properly only when -- the subprogram is subject to pragma Global. - elsif Global_Seen then + elsif Global_Seen + and then Ekind (Item_Id) in E_Abstract_State + | E_Constant + | E_Loop_Parameter + | E_Protected_Type + | E_Task_Type + | E_Variable + | Formal_Kind + then Usage_Error (Item_Id); end if; end if;