summaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch2.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-10 09:09:59 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-10 09:09:59 +0000
commit54b358df4c76cbf2f0553360aca63292c421af98 (patch)
treeb0c1ad066b60cf2b06a334ed1befc1564b740d90 /gcc/ada/exp_ch2.adb
parentaf5f5e793d0f7301e5e864931a9c91fb9736387f (diff)
downloadgcc-54b358df4c76cbf2f0553360aca63292c421af98.tar.gz
2009-07-10 Ed Schonberg <schonberg@adacore.com>
* sem_prag.adb (Analyze pragma, case Task_Name): Analyze argument of pragma, to capture global references if the context is generic. * exp_ch2.adb (Expand_Discriminant): If a task type discriminant appears within the initialization procedure for the corresponding record, replace it with the proper discriminal. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149459 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_ch2.adb')
-rw-r--r--gcc/ada/exp_ch2.adb13
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/ada/exp_ch2.adb b/gcc/ada/exp_ch2.adb
index 2963ae87246..47b17487b29 100644
--- a/gcc/ada/exp_ch2.adb
+++ b/gcc/ada/exp_ch2.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -308,6 +308,17 @@ package body Exp_Ch2 is
and then In_Entry
then
Set_Entity (N, CR_Discriminant (Entity (N)));
+
+ -- Finally, if the entity is the discriminant of the original
+ -- type declaration, and we are within the initialization
+ -- procedure for a task, the designated entity is the
+ -- discriminal of the task body. This can happen when the
+ -- argument of pragma Task_Name mentions a discriminant,
+ -- because the pragma is analyzed in the task declaration
+ -- but is expanded in the call to Create_Task in the init_proc.
+
+ elsif Within_Init_Proc then
+ Set_Entity (N, Discriminal (CR_Discriminant (Entity (N))));
else
Set_Entity (N, Discriminal (Entity (N)));
end if;