Patchwork Fix PR ada/53737

login
register
mail settings
Submitter Eric Botcazou
Date Dec. 21, 2012, 10:27 p.m.
Message ID <1457843.4KpGgzOI15@polaris>
Download mbox | patch
Permalink /patch/207894/
State New
Headers show

Comments

Eric Botcazou - Dec. 21, 2012, 10:27 p.m.
This is a regression present on mainline and 4.7 branch, in the form of an 
assertion failure.  The check that an RACW type is acceptable an actual for a 
formal type to which a pragma Remote_Access applies need not be performed on a 
defaulted formal type appearing in the internal instantiation of a formal 
package.

Tested on x86-64/Linux, applied on the mainline and 4.7 branch.


2012-12-21  Ed Schonberg  <schonberg@adacore.com>

	PR ada/53737
	* sem_ch12.adb (Analyze_Associations): Do not check the legality of
	actuals for RACW types if this is an internal instantiation for a formal
	package with defaulted parameters.

Patch

Index: sem_ch12.adb
===================================================================
--- sem_ch12.adb	(revision 194669)
+++ sem_ch12.adb	(working copy)
@@ -1448,10 +1448,15 @@  package body Sem_Ch12 is
                   --  defined aspect/pragma Remote_Access_Type. In that case
                   --  the actual must be remote as well.
 
+                  --  If the current instantiation is the construction of a
+                  --  local copy for a formal package the actuals may be
+                  --  defaulted, and there is no matching actual to check.
+
                   if Nkind (Analyzed_Formal) = N_Formal_Type_Declaration
                     and then
                       Nkind (Formal_Type_Definition (Analyzed_Formal)) =
                                             N_Access_To_Object_Definition
+                     and then Present (Match)
                   then
                      declare
                         Formal_Ent : constant Entity_Id :=