This patch corrects machinery which detects whether one node appears earlier in
the tree with respect to another node.

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

2012-01-30  Hristian Kirtchev  <kirtc...@adacore.com>

        * sem_ch12.adb (Earlier): Do not use the
        top level source locations of the two input nodes.

Index: sem_ch12.adb
===================================================================
--- sem_ch12.adb        (revision 183698)
+++ sem_ch12.adb        (working copy)
@@ -7142,13 +7142,12 @@
       end if;
 
       --  At this point either both nodes came from source or we approximated
-      --  their source locations through neighbouring source statements.
+      --  their source locations through neighbouring source statements. There
+      --  is no need to look at the top level locations of P1 and P2 because
+      --  both nodes are in the same list and whether the enclosing context is
+      --  instantiated is irrelevant.
 
-      if Top_Level_Location (Sloc (P1)) < Top_Level_Location (Sloc (P2)) then
-         return True;
-      else
-         return False;
-      end if;
+      return Sloc (P1) < Sloc (P2);
    end Earlier;
 
    ----------------------

Reply via email to