Some additional cases of internal routines are now detected and skip
predicate tests on arguments. Not clear if this fixes additional
problems or not, but it is certainly a desirable change. No further
test required.

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

2014-07-30  Robert Dewar  <de...@adacore.com>

        * sem_util.adb (Predicate_Tests_On_Arguments): Omit tests for
        some additional cases of internally generated routines.

Index: sem_util.adb
===================================================================
--- sem_util.adb        (revision 213212)
+++ sem_util.adb        (working copy)
@@ -14723,32 +14723,42 @@
 
    function Predicate_Tests_On_Arguments (Subp : Entity_Id) return Boolean is
    begin
+      --  Always test predicates on indirect call
+
+      if Ekind (Subp) = E_Subprogram_Type then
+         return True;
+
       --  Do not test predicates on call to generated default Finalize, since
       --  we are not interested in whether something we are finalizing (and
       --  typically destroying) satisfies its predicates.
 
-      if Chars (Subp) = Name_Finalize
+      elsif Chars (Subp) = Name_Finalize
         and then not Comes_From_Source (Subp)
       then
          return False;
 
-         --  Do not test predicates on call to Init_Proc, since if needed the
-         --  predicate test will occur at some other point.
+      --  Do not test predicates on any internally generated routines
 
+      elsif Is_Internal_Name (Chars (Subp)) then
+         return False;
+
+      --  Do not test predicates on call to Init_Proc, since if needed the
+      --  predicate test will occur at some other point.
+
       elsif Is_Init_Proc (Subp) then
          return False;
 
-         --  Do not test predicates on call to predicate function, since this
-         --  would cause infinite recursion.
+      --  Do not test predicates on call to predicate function, since this
+      --  would cause infinite recursion.
 
       elsif Ekind (Subp) = E_Function
         and then (Is_Predicate_Function (Subp)
-                  or else
+                    or else
                   Is_Predicate_Function_M (Subp))
       then
          return False;
 
-         --  For now, no other exceptions
+      --  For now, no other exceptions
 
       else
          return True;

Reply via email to