|
6 | 6 | ! higher openmp version than the others, so need a separate file. |
7 | 7 |
|
8 | 8 |
|
9 | | - real a, b |
10 | | - logical r |
| 9 | + real a, b, c |
11 | 10 | a = 1.0 |
12 | 11 | b = 2.0 |
| 12 | + c = 3.0 |
13 | 13 | !$omp parallel num_threads(4) |
14 | 14 | ! First a few things that should compile without error. |
15 | 15 | !$omp atomic seq_cst, compare |
16 | | - r = b .ne. a |
| 16 | + if (b .eq. a) then |
| 17 | + b = c |
| 18 | + end if |
17 | 19 |
|
18 | 20 | !$omp atomic seq_cst compare |
19 | | - r = a .ge. b |
| 21 | + if (a .eq. b) a = c |
20 | 22 | !$omp end atomic |
21 | 23 |
|
22 | 24 | !$omp atomic compare acquire hint(OMP_LOCK_HINT_CONTENDED) |
23 | | - r = a .lt. b |
| 25 | + if (b .eq. a) b = c |
24 | 26 |
|
25 | 27 | !$omp atomic release hint(OMP_LOCK_HINT_UNCONTENDED) compare |
26 | | - r = a .gt. b |
| 28 | + if (b .eq. a) b = c |
27 | 29 |
|
28 | 30 | !$omp atomic compare seq_cst |
29 | | - r = b .ne. a |
| 31 | + if (b .eq. c) b = a |
30 | 32 |
|
31 | 33 | !$omp atomic hint(1) acq_rel compare |
32 | | - r = b .eq. a |
| 34 | + if (b .eq. a) b = c |
33 | 35 | !$omp end atomic |
34 | 36 |
|
35 | 37 | ! Check for error conidtions: |
36 | 38 | !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct |
37 | 39 | !ERROR: At most one SEQ_CST clause can appear on the COMPARE directive |
38 | 40 | !$omp atomic seq_cst seq_cst compare |
39 | | - r = a .le. b |
| 41 | + if (b .eq. c) b = a |
40 | 42 | !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct |
41 | 43 | !ERROR: At most one SEQ_CST clause can appear on the COMPARE directive |
42 | 44 | !$omp atomic compare seq_cst seq_cst |
43 | | - r = b .gt. a |
| 45 | + if (b .eq. c) b = a |
44 | 46 | !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct |
45 | 47 | !ERROR: At most one SEQ_CST clause can appear on the COMPARE directive |
46 | 48 | !$omp atomic seq_cst compare seq_cst |
47 | | - r = b .ge. b |
| 49 | + if (b .eq. c) b = a |
48 | 50 |
|
49 | 51 | !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct |
50 | 52 | !ERROR: At most one ACQUIRE clause can appear on the COMPARE directive |
51 | 53 | !$omp atomic acquire acquire compare |
52 | | - r = a .le. b |
| 54 | + if (b .eq. c) b = a |
53 | 55 | !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct |
54 | 56 | !ERROR: At most one ACQUIRE clause can appear on the COMPARE directive |
55 | 57 | !$omp atomic compare acquire acquire |
56 | | - r = b .gt. a |
| 58 | + if (b .eq. c) b = a |
57 | 59 | !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct |
58 | 60 | !ERROR: At most one ACQUIRE clause can appear on the COMPARE directive |
59 | 61 | !$omp atomic acquire compare acquire |
60 | | - r = b .ge. b |
| 62 | + if (b .eq. c) b = a |
61 | 63 |
|
62 | 64 | !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct |
63 | 65 | !ERROR: At most one RELAXED clause can appear on the COMPARE directive |
64 | 66 | !$omp atomic relaxed relaxed compare |
65 | | - r = a .le. b |
| 67 | + if (b .eq. c) b = a |
66 | 68 | !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct |
67 | 69 | !ERROR: At most one RELAXED clause can appear on the COMPARE directive |
68 | 70 | !$omp atomic compare relaxed relaxed |
69 | | - r = b .gt. a |
| 71 | + if (b .eq. c) b = a |
70 | 72 | !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct |
71 | 73 | !ERROR: At most one RELAXED clause can appear on the COMPARE directive |
72 | 74 | !$omp atomic relaxed compare relaxed |
73 | | - r = b .ge. b |
| 75 | + if (b .eq. c) b = a |
74 | 76 |
|
75 | 77 | !$omp end parallel |
76 | 78 | end |
0 commit comments