[Ada] Incorrect SCOs for loops in separates

Message ID 20130705094353.GA2731@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet July 5, 2013, 9:43 a.m.
This change adds a missing guard to the SCO generation circuitry that caused
bogus extra SCOs to be generated for loop statements in separate bodies.

The following compilation must produce the indicated SCOs:

$ gcc -c -fdump-scos pak.adb
$ grep "^C" pak.ali
C 3 pak-p.adb
CS F3:8-3:18
CS >S3:8 4:7-4:7

package body Pak is
    procedure P is separate;
end Pak;
package Pak is
   procedure P;
end Pak;
separate (Pak) procedure P is
   for J in 0 .. 0 loop
   end loop;
end P;

2013-07-05  Thomas Quinot  <quinot@adacore.com>

	* par_sco.adb (Traverse_Declarations_Or_Statements): Ignore
	N_Implicit_Label_Declaration nodes.


Index: par_sco.adb
--- par_sco.adb	(revision 200688)
+++ par_sco.adb	(working copy)
@@ -2095,7 +2095,13 @@ 
       if Is_Non_Empty_List (L) then
          N := First (L);
          while Present (N) loop
-            Traverse_One (N);
+            --  Note: For separate bodies, we see the tree after Par.Labl has
+            --  introduced implicit labels, so we need to ignore those nodes.
+            if Nkind (N) /= N_Implicit_Label_Declaration then
+               Traverse_One (N);
+            end if;
             Next (N);
          end loop;