Fix gcc.c-torture/execute/ieee/cdivchkf.c on hpux
[official-gcc.git] / libgomp / testsuite / libgomp.fortran / omp_atomic5.f90
blob292a7f62a2f45dc880e8a2daf8fc184330b9ec21
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 e(:) = 5
8 e(7) = 9
9 !$omp atomic write seq_cst
10 a = 1
11 !$omp atomic seq_cst, write
12 b = 2
13 !$omp atomic write, seq_cst
14 c = 3
15 !$omp atomic seq_cst write
16 d = 4
17 !$omp atomic capture seq_cst
18 a2 = a
19 a = a + 4
20 !$omp end atomic
21 !$omp atomic capture, seq_cst
22 b = b - 18
23 b2 = b
24 !$omp end atomic
25 !$omp atomic seq_cst, capture
26 c2 = c
27 c = 2.0 * c
28 !$omp end atomic
29 !$omp atomic seq_cst capture
30 d = d / 2.0
31 d2 = d
32 !$omp end atomic
33 if (a2 .ne. 1 .or. b2 .ne. -16 .or. c2 .ne. 3 .or. d2 .ne. 2) stop 1
34 !$omp atomic read seq_cst
35 a2 = a
36 !$omp atomic seq_cst, read
37 c2 = c
38 if (a2 .ne. 5 .or. b2 .ne. -16 .or. c2 .ne. 6 .or. d2 .ne. 2) stop 2
39 a2 = 10
40 if (a2 .ne. 10) stop 3
41 !$omp atomic capture
42 a2 = a
43 a = e(1) + e(6) + e(7) * 2
44 !$omp endatomic
45 if (a2 .ne. 5) stop 4
46 !$omp atomic read
47 a2 = a
48 !$omp end atomic
49 if (a2 .ne. 28) stop 5
50 !$omp atomic capture seq_cst
51 b2 = b
52 b = e(1) + e(7) + e(5) * 2
53 !$omp end atomic
54 if (b2 .ne. -16) stop 6
55 !$omp atomic seq_cst, read
56 b2 = b
57 !$omp end atomic
58 if (b2 .ne. 24) stop 7
59 end