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.
-- 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;