When using a restricted run time (such as ZFP or Ravenscar), the compiler
failed when there was a renaming of an attribute as subprogram because
it tried to load a package not available. This patch avoids this problem
by checking before trying to load the offending package.

The following must compile quietly:

package Rename_Attribute is
   function Integer_Pred (J: in Integer) return Integer renames Integer'Pred;
end Rename_Attribute;

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-09-01  Jose Ruiz  <r...@adacore.com>

        * sem_ch8.adb (Attribute_Renaming): Add missing check to avoid loading
        package System.Aux_Dec when using restricted run-time libraries which
        do not have this package.

Index: sem_ch8.adb
===================================================================
--- sem_ch8.adb (revision 178381)
+++ sem_ch8.adb (working copy)
@@ -3290,10 +3290,12 @@
       --  type is still not frozen). We exclude from this processing generic
       --  formal subprograms found in instantiations and AST_Entry renamings.
 
-      --  We must exclude VM targets because entity AST_Handler is defined in
-      --  package System.Aux_Dec which is not available in those platforms.
+      --  We must exclude VM targets and restricted run-time libraries because
+      --  entity AST_Handler is defined in package System.Aux_Dec which is not
+      --  available in those platforms.
 
       if VM_Target = No_VM
+        and then not Restricted_Profile
         and then not Present (Corresponding_Formal_Spec (N))
         and then Etype (Nam) /= RTE (RE_AST_Handler)
       then

Reply via email to