1-- { dg-do compile }
2-- { dg-options "-fdump-tree-gimple" }
3
4with Atomic6_Pkg; use Atomic6_Pkg;
5
6procedure Atomic6_2 is
7  Temp : Integer;
8begin
9
10  Counter1 := Counter1 + Counter2;
11
12  Timer1 := Timer1 + Timer2;
13
14  Counter1 := Counter1 + Int(Timer1);
15  Timer1 := Timer1 + Integer(Counter1);
16
17  Temp := Integer(Counter1) + Timer1;
18  Counter1 := Int(Timer1) + Int(Temp);
19  Timer1 := Integer(Counter1) + Temp;
20
21  if Counter1 /= Counter2 then
22    raise Program_Error;
23  end if;
24
25  if Timer1 /= Timer2 then
26    raise Program_Error;
27  end if;
28
29end;
30
31-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&atomic6_pkg__counter1" 6 "gimple"} }
32-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&atomic6_pkg__counter2" 2 "gimple"} }
33-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&atomic6_pkg__timer1" 6 "gimple"} }
34-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&atomic6_pkg__timer2" 2 "gimple"} }
35-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*&temp" 0 "gimple"} }
36-- { dg-final { scan-tree-dump-times "atomic_load\[^\n\r\]*ptr" 0 "gimple"} }
37
38-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&atomic6_pkg__counter1" 3 "gimple"} }
39-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&atomic6_pkg__counter2" 0 "gimple"} }
40-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&atomic6_pkg__timer1" 3 "gimple"} }
41-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&atomic6_pkg__timer2" 0 "gimple"} }
42-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*&temp" 0 "gimple"} }
43-- { dg-final { scan-tree-dump-times "atomic_store\[^\n\r\]*ptr" 0 "gimple"} }
44
45