sem_ch5.adb (Analyze_Assignment_Statement): Apply conversion to right-hand side when...
authorArnaud Charlet <charlet@gcc.gnu.org>
Tue, 5 Aug 2008 14:37:44 +0000 (16:37 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Tue, 5 Aug 2008 14:37:44 +0000 (16:37 +0200)
2008-08-05  Ed Schonberg  <schonberg@adacore.com>

* sem_ch5.adb (Analyze_Assignment_Statement): Apply conversion to
right-hand side when it is an anonymous access_to_subprogram, to force
static accessibility check when needed.

From-SVN: r138723

gcc/ada/ChangeLog
gcc/ada/sem_ch5.adb

index 38a333a..a0b29ac 100644 (file)
@@ -1,3 +1,25 @@
+2008-08-05  Thomas Quinot  <quinot@adacore.com>
+
+       * gsocket.h: Make this file includable in a Nucleus environment, which
+       does not support sockets.
+
+       * socket.c: Remove Nucleus-specific hack.
+
+2008-08-05  Pascal Obry  <obry@adacore.com>
+
+       * adaint.c: Remove support for readable attribute on vxworks and nucleus
+
+2008-08-05  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_attr.adb:
+       (Analyze_Attribute, case 'Result): handle properly the case where some
+       operand of the expression in a post-condition generates a transient
+       block.
+
+       * sem_ch5.adb (Analyze_Assignment_Statement): Apply conversion to
+       right-hand side when it is an anonymous access_to_subprogram, to force
+       static accessibility check when needed.
+
 2008-08-05  Sergey Rybin  <rybin@adacore.com>
 
        * gnat_ugn.texi: Changing the description of the gnatcheck metrics
index 1396759..e5954a9 100644 (file)
@@ -581,16 +581,19 @@ package body Sem_Ch5 is
 
       --  Ada 2005 (AI-385): When the lhs type is an anonymous access type,
       --  apply an implicit conversion of the rhs to that type to force
-      --  appropriate static and run-time accessibility checks. This
-      --  applies as well to anonymous access-to-subprogram types that
-      --  are component subtypes.
+      --  appropriate static and run-time accessibility checks. This applies
+      --  as well to anonymous access-to-subprogram types that are component
+      --  subtypes or formal parameters.
 
       if Ada_Version >= Ada_05
         and then Is_Access_Type (T1)
-        and then Is_Local_Anonymous_Access (T1)
       then
-         Rewrite (Rhs, Convert_To (T1, Relocate_Node (Rhs)));
-         Analyze_And_Resolve (Rhs, T1);
+         if Is_Local_Anonymous_Access (T1)
+           or else Ekind (T2) = E_Anonymous_Access_Subprogram_Type
+         then
+            Rewrite (Rhs, Convert_To (T1, Relocate_Node (Rhs)));
+            Analyze_And_Resolve (Rhs, T1);
+         end if;
       end if;
 
       --  Ada 2005 (AI-231): Assignment to not null variable