aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/vfa1_1.adb
blob: f173c3f95a53abbad0bbd70559566b727fd8b2bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
-- { dg-do compile }
-- { dg-options "-fdump-tree-gimple" }

with VFA1_Pkg; use VFA1_Pkg;

procedure VFA1_1 is
  Temp : Integer;

  function F (I : Integer) return Integer is
  begin
    return I;
  end;

  function F2 return Integer is
  begin
    return Integer(Counter1);
  end;

  procedure P3 (I : Out Integer) is
  begin
    null;
  end;

begin

  Counter1 := Int(Counter2);
  Counter2 := Integer(Counter1);

  Temp := Integer(Counter1);
  Counter1 := Int(Temp);

  Temp := Counter2;
  Counter2 := Temp;

  Temp := Integer (Counter1) + Counter2;

  if Counter1 /= Int (Counter2) then
    raise Program_Error;
  end if;

  Temp := F(Integer (Counter1));
  Counter1 := Int(F(Temp));

  Temp := F(Counter2);
  Counter2 := F(Temp);

  Temp := F2;
  P3 (Counter2);

end;

-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&vfa1_pkg__counter1" 6 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&vfa1_pkg__counter2" 5 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&temp" 0 "gimple"} }

-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&vfa1_pkg__counter1" 3 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&vfa1_pkg__counter2" 4 "gimple"} }
-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&temp" 0 "gimple"} }