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

Arnaud Charlet charlet@adacore.com
Wed Sep 6 12:16:00 GMT 2017


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.

-------------- next part --------------
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


More information about the Gcc-patches mailing list