From 4e2a165210c07078ad1226ca3f0712a457a73d0e Mon Sep 17 00:00:00 2001 From: Ed Schonberg Date: Tue, 23 Jul 2019 08:13:41 +0000 Subject: [PATCH] [Ada] Aspect CPU may depend on a discriminant of a task type 2019-07-23 Ed Schonberg 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 | 7 +++++++ gcc/ada/sem_ch13.adb | 2 ++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gnat.dg/task4.adb | 19 +++++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 gcc/testsuite/gnat.dg/task4.adb diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 86a5491ad34..64ac98ba1f4 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2019-07-23 Ed Schonberg + + * 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 * checks.adb (Convert_And_Check_Range): Add Suppress parameter diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index dc7f7744991..bf802001d68 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -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. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 883befdbf67..d5efd503cb8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-07-23 Ed Schonberg + + * gnat.dg/task4.adb: New testcase. + 2019-07-23 Eric Botcazou * 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 index 00000000000..9a97503389c --- /dev/null +++ b/gcc/testsuite/gnat.dg/task4.adb @@ -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;