1-- PR debug/80321
2
3-- { dg-do compile }
4-- { dg-options "-O2 -g" }
5
6with Debug10_Pkg; use Debug10_Pkg;
7
8procedure Debug10 (T : Entity_Id) is
9
10   procedure Inner (E : Entity_Id);
11   pragma Inline (Inner);
12
13   procedure Inner (E : Entity_Id) is
14   begin
15      if E /= Empty
16         and then not Nodes (E + 3).Flag16
17      then
18         Debug10 (E);
19      end if;
20   end Inner;
21
22   function Ekind (E : Entity_Id) return Entity_Kind is
23   begin
24      return N_To_E (Nodes (E + 1).Nkind);
25   end Ekind;
26
27begin
28
29   if T = Empty then
30      return;
31   end if;
32
33   Nodes (T + 3).Flag16 := True;
34
35   if Ekind (T) in Object_Kind then
36      Inner (T);
37
38   elsif Ekind (T) in Type_Kind then
39      Inner (T);
40
41      if Ekind (T) in Record_Kind then
42
43         if Ekind (T) = E_Class_Wide_Subtype then
44            Inner (T);
45         end if;
46
47      elsif Ekind (T) in Array_Kind then
48         Inner (T);
49
50      elsif Ekind (T) in Access_Kind then
51         Inner (T);
52
53      elsif Ekind (T) in Scalar_Kind then
54
55         if My_Scalar_Range (T) /= Empty
56           and then My_Test (My_Scalar_Range (T))
57         then
58            if My_Is_Entity_Name (T) then
59               Inner (T);
60            end if;
61
62            if My_Is_Entity_Name (T) then
63               Inner (T);
64            end if;
65         end if;
66      end if;
67   end if;
68end;
69