[Ada] Aspect CPU may depend on a discriminant of a task type

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
This commit is contained in:
Ed Schonberg 2019-07-23 08:13:41 +00:00 committed by Pierre-Marie de Rodat
parent 67460d4575
commit 4e2a165210
4 changed files with 32 additions and 0 deletions

View 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

View 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.

View 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.

View File

@ -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;