[Ada] Up-level addressing problems with private tasks and selective accept procs
diff mbox series

Message ID 20191213095501.GA13911@adacore.com
State New
Headers show
Series
  • [Ada] Up-level addressing problems with private tasks and selective accept procs
Related show

Commit Message

Pierre-Marie de Rodat Dec. 13, 2019, 9:55 a.m. UTC
When a task type has a partial view, the procedure created for a
selective accept statement within the task was not being passed an
activation record actual (despite having such a formal), and also
certain variables addressed up-level were not being stored within the
activation record.  This was because the utility functions that check
that one scope is contained within another were not accounting for the
possibility of private types implemented by task types. This is fixed by
looking at the underlying base type within those utility functions.

Tested on x86_64-pc-linux-gnu, committed on trunk

2019-12-13  Gary Dismukes  <dismukes@adacore.com>

gcc/ada/

	* sem_util.adb (Scope_Within): For the case of checking for a
	task type procedure, check the Implementation_Base_Type of Curr.
	(Scope_Within_Or_Same): For the case of checking for a task type
	procedure, check the Implementation_Base_Type of Curr.

Patch
diff mbox series

--- gcc/ada/sem_util.adb
+++ gcc/ada/sem_util.adb
@@ -24721,8 +24721,9 @@  package body Sem_Util is
          --  A selective accept body appears within a task type, but the
          --  enclosing subprogram is the procedure of the task body.
 
-         elsif Ekind (Curr) = E_Task_Type
-           and then Outer = Task_Body_Procedure (Curr)
+         elsif Ekind (Implementation_Base_Type (Curr)) = E_Task_Type
+           and then
+             Outer = Task_Body_Procedure (Implementation_Base_Type (Curr))
          then
             return True;
 
@@ -24763,8 +24764,9 @@  package body Sem_Util is
          if Curr = Outer then
             return True;
 
-         elsif Ekind (Curr) = E_Task_Type
-           and then Outer = Task_Body_Procedure (Curr)
+         elsif Ekind (Implementation_Base_Type (Curr)) = E_Task_Type
+           and then
+             Outer = Task_Body_Procedure (Implementation_Base_Type (Curr))
          then
             return True;