diff mbox series

[Ada] Reject invalid use of Global/Depends on object declaration

Message ID 20170906121647.GA59255@adacore.com
State New
Headers show
Series [Ada] Reject invalid use of Global/Depends on object declaration | expand

Commit Message

Arnaud Charlet Sept. 6, 2017, 12:16 p.m. UTC
GNAT failed to issue an error on a Global/Depends aspect put on an object
declaration, which is only allowed for a task object. Instead it crashed.
Now fixed.

Tested on x86_64-pc-linux-gnu, committed on trunk

2017-09-06  Yannick Moy  <moy@adacore.com>

	* sem_prag.adb (Analyze_Depends_Global): Reinforce test on object
	declarations to only consider valid uses of Global/Depends those on
	single concurrent objects.
diff mbox series

Patch

Index: sem_prag.adb
===================================================================
--- sem_prag.adb	(revision 251778)
+++ sem_prag.adb	(working copy)
@@ -4080,7 +4080,10 @@ 
 
          --  Object declaration of a single concurrent type
 
-         elsif Nkind (Subp_Decl) = N_Object_Declaration then
+         elsif Nkind (Subp_Decl) = N_Object_Declaration
+           and then Is_Single_Concurrent_Object
+                      (Unique_Defining_Entity (Subp_Decl))
+         then
             null;
 
          --  Single task type