1-- { dg-do compile }
2-- { dg-options "-fdump-tree-gimple" }
3
4with VFA1_Pkg; use VFA1_Pkg;
5
6procedure VFA1_2 is
7  Temp : Int8_t;
8
9  function F (I : Int8_t) return Int8_t is
10  begin
11    return I;
12  end;
13
14  function F2 return Int8_t is
15  begin
16    return Int8_t(Timer1(1));
17  end;
18
19  procedure P3 (I : out Int8_t) is
20  begin
21    null;
22  end;
23
24begin
25
26  Temp := Timer1(1);
27  Timer1(2) := Temp;
28
29  Temp := Timer2(1);
30  Timer2(2) := Temp;
31
32  Temp := Timer1(1) + Timer2(2);
33
34  if Timer1(1) /= Timer2(2) then
35    raise Program_Error;
36  end if;
37
38  Temp := F(Timer1(1));
39  Timer2(2) := F(Temp);
40
41  Temp := F(Timer2(2));
42  Timer1(1) := F(Temp);
43
44  Temp := F2;
45  P3 (Timer2(2));
46
47end;
48
49-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&vfa1_pkg__timer1" 7 "gimple"} }
50-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&vfa1_pkg__timer2" 7 "gimple"} }
51-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&temp" 0 "gimple"} }
52
53-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&vfa1_pkg__timer1" 2 "gimple"} }
54-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&vfa1_pkg__timer2" 3 "gimple"} }
55-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&temp" 0 "gimple"} }
56
57