1! PR fortran/92899
2
3program pr92899
4  real :: x = 1.0
5  double precision :: y
6  integer(kind=4) :: z = 4
7  integer(kind=8) :: w
8  !$omp atomic capture
9  y = x
10  x = 2.0
11  !$omp end atomic
12  if (y /= 1.0 .or. x /= 2.0) stop 1
13  !$omp atomic capture
14  x = y
15  y = 3.0
16  !$omp end atomic
17  if (x /= 1.0 .or. y /= 3.0) stop 2
18  !$omp atomic capture
19  w = z
20  z = 5
21  !$omp end atomic
22  if (w /= 4 .or. z /= 5) stop 3
23  !$omp atomic capture
24  z = w
25  w = 6
26  !$omp end atomic
27  if (z /= 4 .or. w /= 6) stop 4
28  !$omp atomic write
29  x = y
30  !$omp end atomic
31  if (x /= 3.0 .or. y /= 3.0) stop 5
32  x = 7.0
33  !$omp atomic write
34  y = x
35  !$omp end atomic
36  if (x /= 7.0 .or. y /= 7.0) stop 6
37  !$omp atomic write
38  z = w
39  !$omp end atomic
40  if (z /= 6 .or. w /= 6) stop 7
41  z = 8
42  !$omp atomic write
43  w = z
44  !$omp end atomic
45  if (z /= 8 .or. w /= 8) stop 8
46end
47