aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_attr.adb
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2009-04-08 14:31:44 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2009-04-08 16:31:44 +0200
commitae8c7d8762ad36ce460e495cd82e46f7ebd9552d (patch)
tree5c7d5ca8363e3376e29cd2917f4cc98c87d8eae6 /gcc/ada/exp_attr.adb
parentff69f95af086f0041be775afb527e3b98f9e8bf6 (diff)
downloadgcc-ae8c7d8762ad36ce460e495cd82e46f7ebd9552d.zip
gcc-ae8c7d8762ad36ce460e495cd82e46f7ebd9552d.tar.gz
gcc-ae8c7d8762ad36ce460e495cd82e46f7ebd9552d.tar.bz2
exp_attr.adb, [...]: Code clean up.
2009-04-08 Robert Dewar <dewar@adacore.com> * exp_attr.adb, sem_attr.adb, sem_util.adb: Code clean up. From-SVN: r145741
Diffstat (limited to 'gcc/ada/exp_attr.adb')
-rw-r--r--gcc/ada/exp_attr.adb7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb
index 04e7a0b..7f82cde 100644
--- a/gcc/ada/exp_attr.adb
+++ b/gcc/ada/exp_attr.adb
@@ -867,7 +867,9 @@ package body Exp_Attr is
-- If the prefix of an Access attribute is a dereference of an
-- access parameter (or a renaming of such a dereference, or a
-- subcomponent of such a dereference) and the context is a
- -- general access type (but not an anonymous access type), then
+ -- general access type (including the type of an object or
+ -- component with an access_definition, but not the anonymous
+ -- type of an access parameter or access discriminant), then
-- apply an accessibility check to the access parameter. We used
-- to rewrite the access parameter as a type conversion, but that
-- could only be done if the immediate prefix of the Access
@@ -882,7 +884,8 @@ package body Exp_Attr is
elsif Id = Attribute_Access
and then Nkind (Enc_Object) = N_Explicit_Dereference
and then Is_Entity_Name (Prefix (Enc_Object))
- and then Ekind (Btyp) = E_General_Access_Type
+ and then (Ekind (Btyp) = E_General_Access_Type
+ or else Is_Local_Anonymous_Access (Btyp))
and then Ekind (Entity (Prefix (Enc_Object))) in Formal_Kind
and then Ekind (Etype (Entity (Prefix (Enc_Object))))
= E_Anonymous_Access_Type