aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorHristian Kirtchev <kirtchev@adacore.com>2007-10-15 15:54:57 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2007-10-15 15:54:57 +0200
commit3c2c15ab48de03a93bd80283b122977e9c04bf45 (patch)
tree8ff0d7f1ea0c299463f08e93f145f3a9def8887a /gcc/ada
parentae7adb1b554f9a17421c74f45a727e90ef87682e (diff)
downloadgcc-3c2c15ab48de03a93bd80283b122977e9c04bf45.zip
gcc-3c2c15ab48de03a93bd80283b122977e9c04bf45.tar.gz
gcc-3c2c15ab48de03a93bd80283b122977e9c04bf45.tar.bz2
exp_ch9.adb (Actual_Index_Expression): When the expansion occurs inside a generic body...
2007-10-15 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch9.adb (Actual_Index_Expression): When the expansion occurs inside a generic body, retrieve the full view of the entry family discrete subtype if available. From-SVN: r129324
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/exp_ch9.adb47
1 files changed, 47 insertions, 0 deletions
diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb
index 8874f8d..87fbc12 100644
--- a/gcc/ada/exp_ch9.adb
+++ b/gcc/ada/exp_ch9.adb
@@ -511,6 +511,53 @@ package body Exp_Ch9 is
elsif Ekind (Prev) = E_Entry_Family then
S :=
Etype (Discrete_Subtype_Definition (Declaration_Node (Prev)));
+
+ -- The need for the following full view retrieval stems from
+ -- this complex case of nested generics and tasking:
+
+ -- generic
+ -- type Formal_Index is range <>;
+ -- ...
+ -- package Outer is
+ -- type Index is private;
+ -- generic
+ -- ...
+ -- package Inner is
+ -- procedure P;
+ -- end Inner;
+ -- private
+ -- type Index is new Formal_Index range 1 .. 10;
+ -- end Outer;
+
+ -- package body Outer is
+ -- task type T is
+ -- entry Fam (Index); -- (2)
+ -- entry E;
+ -- end T;
+ -- package body Inner is -- (3)
+ -- procedure P is
+ -- begin
+ -- T.E; -- (1)
+ -- end P;
+ -- end Inner;
+ -- ...
+
+ -- We are currently building the index expression for the entry
+ -- call "T.E" (1). Part of the expansion must mention the range
+ -- of the discrete type "Index" (2) of entry family "Fam".
+ -- However only the private view of type "Index" is available to
+ -- the inner generic (3) because there was no prior mention of
+ -- the type inside "Inner". This visibility requirement is
+ -- implicit and cannot be detected during the construction of
+ -- the generic trees and needs special handling.
+
+ if In_Instance_Body
+ and then Is_Private_Type (S)
+ and then Present (Full_View (S))
+ then
+ S := Full_View (S);
+ end if;
+
Lo := Type_Low_Bound (S);
Hi := Type_High_Bound (S);