Fix build on sparc64-linux-gnu.
[official-gcc.git] / libgomp / testsuite / libgomp.fortran / omp_atomic4.f90
blobc4cb5cf9de926ae1289494b5159874828dda28ce
1 ! { dg-do run }
2 integer (kind = 4) :: a, a2
3 integer (kind = 2) :: b, b2
4 real :: c
5 double precision :: d, d2, c2
6 integer, dimension (10) :: e
7 !$omp atomic write
8 a = 1
9 !$omp atomic write
10 b = 2
11 !$omp atomic write
12 c = 3
13 !$omp atomic write
14 d = 4
15 !$omp atomic capture
16 a2 = a
17 a = a + 4
18 !$omp end atomic
19 !$omp atomic capture
20 b = b - 18
21 b2 = b
22 !$omp end atomic
23 !$omp atomic capture
24 c2 = c
25 c = 2.0 * c
26 !$omp end atomic
27 !$omp atomic capture
28 d = d / 2.0
29 d2 = d
30 !$omp end atomic
31 if (a2 .ne. 1 .or. b2 .ne. -16 .or. c2 .ne. 3 .or. d2 .ne. 2) STOP 1
32 !$omp atomic read
33 a2 = a
34 !$omp atomic read
35 c2 = c
36 if (a2 .ne. 5 .or. b2 .ne. -16 .or. c2 .ne. 6 .or. d2 .ne. 2) STOP 2
37 end