[Ada] Aspect CPU may depend on a discriminant of a task type
authorEd Schonberg <schonberg@adacore.com>
Tue, 23 Jul 2019 08:13:41 +0000 (08:13 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Tue, 23 Jul 2019 08:13:41 +0000 (08:13 +0000)
2019-07-23  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_ch13.adb (Check_Aspect_At_End_Of_Declarations,
Freeze_Entity_Checks): Include Aspect_CPU with other aspects
whose expresssion may depend on a discriminant, and thus require
that components of the type be made visible.

gcc/testsuite/

* gnat.dg/task4.adb: New testcase.

From-SVN: r273726

gcc/ada/ChangeLog
gcc/ada/sem_ch13.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/task4.adb [new file with mode: 0644]

index 86a5491..64ac98b 100644 (file)
@@ -1,3 +1,10 @@
+2019-07-23  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch13.adb (Check_Aspect_At_End_Of_Declarations,
+       Freeze_Entity_Checks): Include Aspect_CPU with other aspects
+       whose expresssion may depend on a discriminant, and thus require
+       that components of the type be made visible.
+
 2019-07-23  Eric Botcazou  <ebotcazou@adacore.com>
 
        * checks.adb (Convert_And_Check_Range): Add Suppress parameter
index dc7f774..bf80200 100644 (file)
@@ -9388,6 +9388,7 @@ package body Sem_Ch13 is
          elsif A_Id = Aspect_Dynamic_Predicate
            or else A_Id = Aspect_Predicate
            or else A_Id = Aspect_Priority
+           or else A_Id = Aspect_CPU
          then
             Push_Type (Ent);
             Preanalyze_Spec_Expression (End_Decl_Expr, T);
@@ -11279,6 +11280,7 @@ package body Sem_Ch13 is
                   if A_Id = Aspect_Dynamic_Predicate
                     or else A_Id = Aspect_Predicate
                     or else A_Id = Aspect_Priority
+                    or else A_Id = Aspect_CPU
                   then
                     --  Retrieve the visibility to components and discriminants
                     --  in order to properly analyze the aspects.
index 883befd..d5efd50 100644 (file)
@@ -1,3 +1,7 @@
+2019-07-23  Ed Schonberg  <schonberg@adacore.com>
+
+       * gnat.dg/task4.adb: New testcase.
+
 2019-07-23  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/range_check5.adb: New testcase.
diff --git a/gcc/testsuite/gnat.dg/task4.adb b/gcc/testsuite/gnat.dg/task4.adb
new file mode 100644 (file)
index 0000000..9a97503
--- /dev/null
@@ -0,0 +1,19 @@
+--  { dg-do compile }
+
+with System.Multiprocessors;
+
+procedure Task4 is
+
+  task type Infinite_Loop (C : System.Multiprocessors.CPU_Range)
+     with CPU => C;
+
+  task body Infinite_Loop is
+  begin
+     loop
+        null;
+     end loop;
+  end Infinite_Loop;
+
+begin
+  null;
+end Task4;