Support -std=f2018
[official-gcc.git] / libgomp / testsuite / libgomp.fortran / omp_atomic3.f90
blobe8923d1f21468e91091fc8c6f03a925e8fffc438
1 ! { dg-do run }
2 integer (kind = 4) :: a, a2
3 integer (kind = 2) :: b, b2
4 real :: c, f
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 end atomic
12 !$omp atomic write
13 c = 3
14 !$omp atomic write
15 d = 1 + 2 + 3 - 2
16 e = 5
17 !$omp atomic write
18 f = 6
19 !$omp end atomic
20 !$omp atomic
21 a = a + 4
22 !$omp end atomic
23 !$omp atomic update
24 b = 4 - b
25 !$omp atomic
26 c = c * 2
27 !$omp atomic update
28 d = 2 / d
29 !$omp end atomic
30 !$omp atomic read
31 a2 = a
32 !$omp atomic read
33 b2 = b
34 !$omp end atomic
35 !$omp atomic read
36 c2 = c
37 !$omp atomic read
38 d2 = d
39 if (a2 .ne. 5 .or. b2 .ne. 2 .or. c2 .ne. 6 .or. d2 .ne. 0.5) call abort
40 !$omp atomic write
41 d = 1.2
42 !$omp atomic
43 a = a + c + d
44 !$omp atomic
45 b = b - (a + c + d)
46 if (a .ne. 12 .or. b .ne. -17) call abort
47 !$omp atomic
48 a = c + d + a
49 !$omp atomic
50 b = a + c + d - b
51 if (a .ne. 19 .or. b .ne. 43) call abort
52 !$omp atomic
53 b = (a + c + d) - b
54 a = 32
55 !$omp atomic
56 a = a / 3.4
57 if (a .ne. 9 .or. b .ne. -16) call abort
58 end