aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2021-10-25 16:33:24 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2021-11-09 09:44:46 +0000
commit9c8bb4d68240c2449c8ec9532f683cdad5bbbdbd (patch)
tree7b3da36fa9604084e3d7945debdf0e7e871bfc87
parent74e514af79c4e01a6ff7fab4b7c7a79cad058c3c (diff)
downloadgcc-9c8bb4d68240c2449c8ec9532f683cdad5bbbdbd.zip
gcc-9c8bb4d68240c2449c8ec9532f683cdad5bbbdbd.tar.gz
gcc-9c8bb4d68240c2449c8ec9532f683cdad5bbbdbd.tar.bz2
[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.
-rw-r--r--gcc/ada/sem_prag.adb10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 10ad82f..1c04814 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;