From: Piotr Trojanek Date: Mon, 25 Oct 2021 14:33:24 +0000 (+0200) Subject: [Ada] Guard against illegal items in Global but not Depends X-Git-Tag: basepoints/gcc-13~3297 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c8bb4d68240c2449c8ec9532f683cdad5bbbdbd;p=thirdparty%2Fgcc.git [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 --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 10ad82fd8a44..1c048145bb47 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;