| 1 |
! { dg-do run } |
| 2 |
|
| 3 |
module m |
| 4 |
integer :: x = 6 |
| 5 |
integer :: w, y |
| 6 |
target :: y |
| 7 |
|
| 8 |
contains |
| 9 |
function foo () |
| 10 |
integer, pointer :: foo |
| 11 |
if (w /= 0) & |
| 12 |
error stop |
| 13 |
foo => y |
| 14 |
end |
| 15 |
end module |
| 16 |
|
| 17 |
program main |
| 18 |
use m |
| 19 |
implicit none |
| 20 |
integer :: v, r |
| 21 |
!$omp atomic |
| 22 |
x = min (8, x) |
| 23 |
!$omp atomic read |
| 24 |
v = x |
| 25 |
if (v /= 6) & |
| 26 |
error stop |
| 27 |
|
| 28 |
!$omp atomic compare |
| 29 |
if (x == 6) x = 7 |
| 30 |
!$omp atomic read |
| 31 |
v = x |
| 32 |
if (v /= 7) & |
| 33 |
error stop |
| 34 |
|
| 35 |
!$omp atomic |
| 36 |
x = min (x, 4) |
| 37 |
!$omp atomic read |
| 38 |
v = x |
| 39 |
if (v /= 4) & |
| 40 |
error stop |
| 41 |
!$omp atomic capture |
| 42 |
x = max(x, 8) |
| 43 |
v = x |
| 44 |
if (v /= 8) & |
| 45 |
error stop |
| 46 |
|
| 47 |
!$omp atomic read |
| 48 |
v = x |
| 49 |
if (x /= 8) & |
| 50 |
error stop |
| 51 |
!$omp atomic capture |
| 52 |
v = x |
| 53 |
x = max (12, x) |
| 54 |
if (v /= 8) & |
| 55 |
error stop |
| 56 |
!$omp atomic read |
| 57 |
v = x |
| 58 |
if (v /= 12) & |
| 59 |
error stop |
| 60 |
!$omp atomic capture |
| 61 |
v = x |
| 62 |
x = max(4, x) |
| 63 |
if (v /= 12) & |
| 64 |
error stop |
| 65 |
!$omp atomic read |
| 66 |
v = x |
| 67 |
if (v /= 12) & |
| 68 |
error stop |
| 69 |
!$omp atomic capture compare |
| 70 |
if (x == 4) then |
| 71 |
x = 4 |
| 72 |
else |
| 73 |
v = x |
| 74 |
endif |
| 75 |
if (v /= 12) & |
| 76 |
error stop |
| 77 |
!$omp atomic write |
| 78 |
x = -32 |
| 79 |
!$omp atomic capture seq_cst fail(relaxed) |
| 80 |
x = max(x, 12_8) |
| 81 |
v = x |
| 82 |
if (v /= 12) & |
| 83 |
error stop |
| 84 |
!$omp atomic read |
| 85 |
v = x |
| 86 |
if (v /= 12) & |
| 87 |
error stop |
| 88 |
!$omp atomic compare |
| 89 |
if (x == 12) x = 16 |
| 90 |
!$omp atomic read |
| 91 |
v = x |
| 92 |
if (v /= 16) & |
| 93 |
error stop |
| 94 |
r = 57 |
| 95 |
!$omp atomic compare capture |
| 96 |
if (x == 16) then |
| 97 |
x = r + 7 |
| 98 |
else |
| 99 |
v = x |
| 100 |
endif |
| 101 |
if (v /= 16) & |
| 102 |
error stop |
| 103 |
!$omp atomic read |
| 104 |
v = x |
| 105 |
if (v /= 64) & |
| 106 |
error stop |
| 107 |
!$omp atomic compare capture |
| 108 |
v = x |
| 109 |
if (x == 64) x = 16 |
| 110 |
if (v /= 64) & |
| 111 |
error stop |
| 112 |
!$omp atomic read |
| 113 |
v = x |
| 114 |
if (v /= 16) & |
| 115 |
error stop |
| 116 |
|
| 117 |
!$omp atomic capture, update, compare seq_cst fail(acquire) |
| 118 |
v = x |
| 119 |
if (x == 73_8 - r) x = 12_2 |
| 120 |
if (v /= 16) & |
| 121 |
error stop |
| 122 |
!$omp atomic read |
| 123 |
v = x |
| 124 |
if (v /= 12) & |
| 125 |
error stop |
| 126 |
!$omp atomic update, compare, capture |
| 127 |
if (x == 69_2 - r) x = 6_8 |
| 128 |
v = x |
| 129 |
if (v /= 6) & |
| 130 |
error stop |
| 131 |
!$omp atomic read |
| 132 |
v = x |
| 133 |
if (v /= 6) & |
| 134 |
error stop |
| 135 |
!$omp atomic |
| 136 |
x = min(x, 8) |
| 137 |
!$omp atomic read |
| 138 |
v = x |
| 139 |
if (v /= 6) & |
| 140 |
error stop |
| 141 |
!$omp atomic compare |
| 142 |
if (x == 6) x = 8 |
| 143 |
!$omp atomic read |
| 144 |
v = x |
| 145 |
if (v /= 8) & |
| 146 |
error stop |
| 147 |
!$omp atomic |
| 148 |
x = min(4,x) |
| 149 |
!$omp atomic read |
| 150 |
v = x |
| 151 |
if (v /= 4) & |
| 152 |
error stop |
| 153 |
!$omp atomic capture |
| 154 |
x = max(8_2, x) |
| 155 |
v = x |
| 156 |
if (v /= 8) & |
| 157 |
error stop |
| 158 |
!$omp atomic read |
| 159 |
v = x |
| 160 |
if (v /= 8) & |
| 161 |
error stop |
| 162 |
!$omp atomic capture |
| 163 |
v = x |
| 164 |
x = max(12_1, x) |
| 165 |
if (v /= 8) & |
| 166 |
error stop |
| 167 |
!$omp atomic read |
| 168 |
v = x |
| 169 |
if (v /= 12) & |
| 170 |
error stop |
| 171 |
!$omp atomic capture |
| 172 |
v = x |
| 173 |
x = max(x, 4_1) |
| 174 |
if (v /= 12) & |
| 175 |
error stop |
| 176 |
!$omp atomic read |
| 177 |
v = x |
| 178 |
if (v /= 12) & |
| 179 |
error stop |
| 180 |
!$omp atomic write |
| 181 |
x = -32 |
| 182 |
!$omp atomic capture ,seq_cst fail ( relaxed ) |
| 183 |
x = max(10_1 + 2_8, x) |
| 184 |
v = x |
| 185 |
!$omp end atomic |
| 186 |
if (v /= 12) & |
| 187 |
error stop |
| 188 |
!$omp atomic read |
| 189 |
v = x |
| 190 |
if (v /= 12) & |
| 191 |
error stop |
| 192 |
!$omp atomic compare |
| 193 |
if (x == 12) x = 16 |
| 194 |
!$omp atomic read |
| 195 |
v = x |
| 196 |
if (v /= 16) & |
| 197 |
error stop |
| 198 |
r = 57 |
| 199 |
!$omp atomic compare capture |
| 200 |
if (x == 15) x = r + 7; v = x |
| 201 |
if (v /= 16) & |
| 202 |
error stop |
| 203 |
!$omp atomic read |
| 204 |
v = x |
| 205 |
if (v /= 16) & |
| 206 |
error stop |
| 207 |
!$omp atomic capture, update, compare seq_cst fail(acquire) |
| 208 |
v = x; if (x == 73_8 - r) x = 12_8 |
| 209 |
!$omp end atomic |
| 210 |
if (v /= 16) & |
| 211 |
error stop |
| 212 |
!$omp atomic read |
| 213 |
v = x |
| 214 |
if (v /= 12) & |
| 215 |
error stop |
| 216 |
!$omp atomic update, compare, capture |
| 217 |
if (x == 69_2 - r) x = 6_1; v = x |
| 218 |
if (v /= 6) & |
| 219 |
error stop |
| 220 |
!$omp atomic read |
| 221 |
v = x |
| 222 |
if (v /= 6) & |
| 223 |
error stop |
| 224 |
v = 24 |
| 225 |
!$omp atomic compare capture |
| 226 |
if (x == 12) then; x = 16; else; v = x; endif |
| 227 |
if (v /= 6) & |
| 228 |
error stop |
| 229 |
v = 32 |
| 230 |
!$omp atomic read |
| 231 |
v = x |
| 232 |
if (v /= 6) & |
| 233 |
error stop |
| 234 |
v = 147 |
| 235 |
!$omp atomic capture compare |
| 236 |
if (x == 6) then; x = 57; else; v = x; endif |
| 237 |
if (v /= 147) & |
| 238 |
error stop |
| 239 |
!$omp atomic read |
| 240 |
v = x |
| 241 |
if (v /= 57) & |
| 242 |
error stop |
| 243 |
!$omp atomic update, compare, weak, seq_cst, fail (relaxed) |
| 244 |
if (x == 137) x = 174 |
| 245 |
!$omp atomic read |
| 246 |
v = x |
| 247 |
if (v /= 57) & |
| 248 |
error stop |
| 249 |
!$omp atomic compare fail (relaxed) |
| 250 |
if (x == 57_2) x = 6_8 |
| 251 |
!$omp atomic read |
| 252 |
v = x |
| 253 |
if (v /= 6) & |
| 254 |
error stop |
| 255 |
v = -5 |
| 256 |
!$omp atomic capture compare |
| 257 |
if (x == 17) then; x = 25; else; v = x; endif |
| 258 |
if (v /= 6) & |
| 259 |
error stop |
| 260 |
!$omp atomic read |
| 261 |
v = x |
| 262 |
if (v /= 6) & |
| 263 |
error stop |
| 264 |
v = 15 |
| 265 |
!$omp atomic capture compare |
| 266 |
if (x == 6) then; x = 23; else; v = x; endif |
| 267 |
if (v /= 15) & |
| 268 |
error stop |
| 269 |
!$omp atomic read |
| 270 |
v = x |
| 271 |
if (v /= 23) & |
| 272 |
error stop |
| 273 |
w = 1 |
| 274 |
!$omp atomic compare capture |
| 275 |
! if (x == 23) then; x = 57; else; foo () = x; endif ! OpenMP 6 |
| 276 |
if (x == 23) then; x = 57; else; y = x; endif |
| 277 |
!$omp atomic read |
| 278 |
v = x |
| 279 |
if (v /= 57) & |
| 280 |
error stop |
| 281 |
!$omp atomic capture update compare |
| 282 |
! if (x == 57) then; x = 23; else; foo () = x; endif ! OpenMP 6 |
| 283 |
if (x == 57) then; x = 23; else; y = x; endif |
| 284 |
!$omp atomic read |
| 285 |
v = x |
| 286 |
if (v /= 23) & |
| 287 |
error stop |
| 288 |
w = 0 |
| 289 |
!$omp atomic compare capture |
| 290 |
! if (x == 24) then; x = 57; else; foo () = x; endif ! OpenMP 6 |
| 291 |
if (x == 24) then; x = 57; else; y = x; endif |
| 292 |
if (y /= 23) & |
| 293 |
error stop |
| 294 |
!$omp atomic read |
| 295 |
v = x |
| 296 |
if (v /= 23) & |
| 297 |
error stop |
| 298 |
y = -5 |
| 299 |
!$omp atomic capture update compare |
| 300 |
if (x == 57) then |
| 301 |
x = 27 |
| 302 |
else |
| 303 |
! foo () = x ! OpenMP 6 |
| 304 |
y = x |
| 305 |
end if |
| 306 |
!$omp end atomic |
| 307 |
if (y /= 23) & |
| 308 |
error stop |
| 309 |
!$omp atomic read |
| 310 |
v = x |
| 311 |
if (v /= 23) & |
| 312 |
error stop |
| 313 |
end |