From 434d3cf1fd098c0f3ab5b8f14bf512e0c077cda6 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 5 Aug 2008 16:37:44 +0200 Subject: [PATCH] sem_ch5.adb (Analyze_Assignment_Statement): Apply conversion to right-hand side when it is an anonymous access_to_subprogram... 2008-08-05 Ed Schonberg * 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 | 22 ++++++++++++++++++++++ gcc/ada/sem_ch5.adb | 15 +++++++++------ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 38a333a..a0b29ac 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,25 @@ +2008-08-05 Thomas Quinot + + * 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 + + * adaint.c: Remove support for readable attribute on vxworks and nucleus + +2008-08-05 Ed Schonberg + + * 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 * gnat_ugn.texi: Changing the description of the gnatcheck metrics diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index 1396759..e5954a9 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -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 -- 2.7.4