]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Improve check of attribute reference
authorRonan Desplanques <desplanques@adacore.com>
Mon, 9 Jan 2023 10:14:05 +0000 (11:14 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 15 May 2023 09:36:41 +0000 (11:36 +0200)
Before this patch, the front end failed to catch many illegal uses
of access attributes of task types.

This patch makes referring to the access attributes of a task type
raise an error, except in the current instance case defined in
clause 8.6 of the reference manual.

gcc/ada/

* sem_attr.adb: sem_attr.adb (Analyze_Access_Attribute): Tighten
validity check for task types.

gcc/ada/sem_attr.adb

index 9de9884069e9dac64535ed1d830c4f2440001f47..ac0c4004930c73a73188260266ada5fcdefef80c 100644 (file)
@@ -1068,9 +1068,11 @@ package body Sem_Attr is
                   Analyze (N);
                   return;
 
-               --  OK if a task type, this test needs sharpening up ???
+               --  OK if current task.
 
-               elsif Is_Task_Type (Typ) then
+               elsif Is_Task_Type (Typ)
+                 and then In_Open_Scopes (Typ)
+               then
                   null;
 
                --  OK if self-reference in an aggregate in Ada 2005, and