346 lines · plain
1! REQUIRES: openmp_runtime2 3! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=504! Semantic checks for OpenMP 5.0 standard 2.17.7 atomic Construct.5 6use omp_lib7 implicit none8 integer :: i, j = 10, k=-100, a9! 2.17.7.110! Handled inside parser.11! OpenMP constructs may not be encountered during execution of an atomic region12 13! 2.17.7.214! At most one memory-order-clause may appear on the construct.15 16!READ17 !ERROR: At most one SEQ_CST clause can appear on the ATOMIC directive18 !$omp atomic seq_cst seq_cst read19 i = j20 !ERROR: At most one SEQ_CST clause can appear on the ATOMIC directive21 !$omp atomic read seq_cst seq_cst22 i = j23 !ERROR: At most one SEQ_CST clause can appear on the ATOMIC directive24 !$omp atomic seq_cst read seq_cst25 i = j26 27 !ERROR: At most one ACQUIRE clause can appear on the ATOMIC directive28 !$omp atomic acquire acquire read29 i = j30 !ERROR: At most one ACQUIRE clause can appear on the ATOMIC directive31 !$omp atomic read acquire acquire32 i = j33 !ERROR: At most one ACQUIRE clause can appear on the ATOMIC directive34 !$omp atomic acquire read acquire35 i = j36 37 !ERROR: At most one RELAXED clause can appear on the ATOMIC directive38 !$omp atomic relaxed relaxed read39 i = j40 !ERROR: At most one RELAXED clause can appear on the ATOMIC directive41 !$omp atomic read relaxed relaxed42 i = j43 !ERROR: At most one RELAXED clause can appear on the ATOMIC directive44 !$omp atomic relaxed read relaxed45 i = j46 47!UPDATE48 !ERROR: At most one SEQ_CST clause can appear on the ATOMIC directive49 !$omp atomic seq_cst seq_cst update50 !ERROR: The atomic variable i should appear as an argument in the update operation51 i = j52 !ERROR: At most one SEQ_CST clause can appear on the ATOMIC directive53 !$omp atomic update seq_cst seq_cst54 !ERROR: The atomic variable i should appear as an argument in the update operation55 i = j56 !ERROR: At most one SEQ_CST clause can appear on the ATOMIC directive57 !$omp atomic seq_cst update seq_cst58 !ERROR: The atomic variable i should appear as an argument in the update operation59 i = j60 61 !ERROR: At most one RELEASE clause can appear on the ATOMIC directive62 !$omp atomic release release update63 !ERROR: The atomic variable i should appear as an argument in the update operation64 i = j65 !ERROR: At most one RELEASE clause can appear on the ATOMIC directive66 !$omp atomic update release release67 !ERROR: The atomic variable i should appear as an argument in the update operation68 i = j69 !ERROR: At most one RELEASE clause can appear on the ATOMIC directive70 !$omp atomic release update release71 !ERROR: The atomic variable i should appear as an argument in the update operation72 i = j73 74 !ERROR: At most one RELAXED clause can appear on the ATOMIC directive75 !$omp atomic relaxed relaxed update76 !ERROR: The atomic variable i should appear as an argument in the update operation77 i = j78 !ERROR: At most one RELAXED clause can appear on the ATOMIC directive79 !$omp atomic update relaxed relaxed80 !ERROR: The atomic variable i should appear as an argument in the update operation81 i = j82 !ERROR: At most one RELAXED clause can appear on the ATOMIC directive83 !$omp atomic relaxed update relaxed84 !ERROR: The atomic variable i should appear as an argument in the update operation85 i = j86 87!CAPTURE88 !ERROR: At most one SEQ_CST clause can appear on the ATOMIC directive89 !$omp atomic seq_cst seq_cst capture90 i = j91 j = k92 !$omp end atomic93 !ERROR: At most one SEQ_CST clause can appear on the ATOMIC directive94 !$omp atomic capture seq_cst seq_cst95 i = j96 j = k97 !$omp end atomic98 99 !ERROR: At most one SEQ_CST clause can appear on the ATOMIC directive100 !$omp atomic seq_cst capture seq_cst101 i = j102 j = k103 !$omp end atomic104 105 !ERROR: At most one RELEASE clause can appear on the ATOMIC directive106 !$omp atomic release release capture107 i = j108 j = k109 !$omp end atomic110 111 !ERROR: At most one RELEASE clause can appear on the ATOMIC directive112 !$omp atomic capture release release113 i = j114 j = k115 !$omp end atomic116 117 !ERROR: At most one RELEASE clause can appear on the ATOMIC directive118 !$omp atomic release capture release119 i = j120 j = k121 !$omp end atomic122 123 !ERROR: At most one RELAXED clause can appear on the ATOMIC directive124 !$omp atomic relaxed relaxed capture125 i = j126 j = k127 !$omp end atomic128 129 !ERROR: At most one RELAXED clause can appear on the ATOMIC directive130 !$omp atomic capture relaxed relaxed131 i = j132 j = k133 !$omp end atomic134 135 !ERROR: At most one RELAXED clause can appear on the ATOMIC directive136 !$omp atomic relaxed capture relaxed137 i = j138 j = k139 !$omp end atomic140 141 !ERROR: At most one ACQ_REL clause can appear on the ATOMIC directive142 !$omp atomic acq_rel acq_rel capture143 i = j144 j = k145 !$omp end atomic146 147 !ERROR: At most one ACQ_REL clause can appear on the ATOMIC directive148 !$omp atomic capture acq_rel acq_rel149 i = j150 j = k151 !$omp end atomic152 153 !ERROR: At most one ACQ_REL clause can appear on the ATOMIC directive154 !$omp atomic acq_rel capture acq_rel155 i = j156 j = k157 !$omp end atomic158 159 !ERROR: At most one ACQUIRE clause can appear on the ATOMIC directive160 !$omp atomic acquire acquire capture161 i = j162 j = k163 !$omp end atomic164 165 !ERROR: At most one ACQUIRE clause can appear on the ATOMIC directive166 !$omp atomic capture acquire acquire167 i = j168 j = k169 !$omp end atomic170 171 !ERROR: At most one ACQUIRE clause can appear on the ATOMIC directive172 !$omp atomic acquire capture acquire173 i = j174 j = k175 !$omp end atomic176 177!WRITE178 !ERROR: At most one SEQ_CST clause can appear on the ATOMIC directive179 !$omp atomic seq_cst seq_cst write180 i = j181 !ERROR: At most one SEQ_CST clause can appear on the ATOMIC directive182 !$omp atomic write seq_cst seq_cst183 i = j184 185 !ERROR: At most one SEQ_CST clause can appear on the ATOMIC directive186 !$omp atomic seq_cst write seq_cst187 i = j188 189 !ERROR: At most one RELEASE clause can appear on the ATOMIC directive190 !$omp atomic release release write191 i = j192 !ERROR: At most one RELEASE clause can appear on the ATOMIC directive193 !$omp atomic write release release194 i = j195 !ERROR: At most one RELEASE clause can appear on the ATOMIC directive196 !$omp atomic release write release197 i = j198 !ERROR: At most one RELAXED clause can appear on the ATOMIC directive199 !$omp atomic relaxed relaxed write200 i = j201 !ERROR: At most one RELAXED clause can appear on the ATOMIC directive202 !$omp atomic write relaxed relaxed203 i = j204 !ERROR: At most one RELAXED clause can appear on the ATOMIC directive205 !$omp atomic relaxed write relaxed206 i = j207 208!No atomic-clause209 !ERROR: At most one RELAXED clause can appear on the ATOMIC directive210 !$omp atomic relaxed relaxed211 !ERROR: The atomic variable i should appear as an argument in the update operation212 i = j213 !ERROR: At most one SEQ_CST clause can appear on the ATOMIC directive214 !$omp atomic seq_cst seq_cst215 !ERROR: The atomic variable i should appear as an argument in the update operation216 i = j217 !ERROR: At most one RELEASE clause can appear on the ATOMIC directive218 !$omp atomic release release219 !ERROR: The atomic variable i should appear as an argument in the update operation220 i = j221 222! 2.17.7.3223! At most one hint clause may appear on the construct.224 225 !ERROR: At most one HINT clause can appear on the ATOMIC directive226 !$omp atomic hint(omp_sync_hint_speculative) hint(omp_sync_hint_speculative) read227 i = j228 !ERROR: At most one HINT clause can appear on the ATOMIC directive229 !$omp atomic hint(omp_sync_hint_nonspeculative) read hint(omp_sync_hint_nonspeculative)230 i = j231 !ERROR: At most one HINT clause can appear on the ATOMIC directive232 !$omp atomic read hint(omp_sync_hint_uncontended) hint (omp_sync_hint_uncontended)233 i = j234 !ERROR: At most one HINT clause can appear on the ATOMIC directive235 !$omp atomic hint(omp_sync_hint_contended) hint(omp_sync_hint_speculative) write236 i = j237 !ERROR: At most one HINT clause can appear on the ATOMIC directive238 !$omp atomic hint(omp_sync_hint_nonspeculative) write hint(omp_sync_hint_nonspeculative)239 i = j240 !ERROR: At most one HINT clause can appear on the ATOMIC directive241 !$omp atomic write hint(omp_sync_hint_none) hint (omp_sync_hint_uncontended)242 i = j243 !ERROR: At most one HINT clause can appear on the ATOMIC directive244 !$omp atomic hint(omp_sync_hint_contended) hint(omp_sync_hint_speculative) write245 i = j246 !ERROR: At most one HINT clause can appear on the ATOMIC directive247 !$omp atomic hint(omp_sync_hint_nonspeculative) write hint(omp_sync_hint_nonspeculative)248 i = j249 !ERROR: At most one HINT clause can appear on the ATOMIC directive250 !$omp atomic write hint(omp_sync_hint_none) hint (omp_sync_hint_uncontended)251 i = j252 !ERROR: At most one HINT clause can appear on the ATOMIC directive253 !$omp atomic hint(omp_sync_hint_contended) hint(omp_sync_hint_speculative) update254 !ERROR: The atomic variable i should appear as an argument in the update operation255 i = j256 !ERROR: At most one HINT clause can appear on the ATOMIC directive257 !$omp atomic hint(omp_sync_hint_nonspeculative) update hint(omp_sync_hint_nonspeculative)258 !ERROR: The atomic variable i should appear as an argument in the update operation259 i = j260 !ERROR: At most one HINT clause can appear on the ATOMIC directive261 !$omp atomic update hint(omp_sync_hint_none) hint (omp_sync_hint_uncontended)262 !ERROR: The atomic variable i should appear as an argument in the update operation263 i = j264 !ERROR: At most one HINT clause can appear on the ATOMIC directive265 !$omp atomic hint(omp_sync_hint_contended) hint(omp_sync_hint_speculative)266 !ERROR: The atomic variable i should appear as an argument in the update operation267 i = j268 !ERROR: At most one HINT clause can appear on the ATOMIC directive269 !$omp atomic hint(omp_sync_hint_none) hint(omp_sync_hint_nonspeculative)270 !ERROR: The atomic variable i should appear as an argument in the update operation271 i = j272 !ERROR: At most one HINT clause can appear on the ATOMIC directive273 !$omp atomic hint(omp_sync_hint_none) hint (omp_sync_hint_uncontended)274 !ERROR: The atomic variable i should appear as an argument in the update operation275 i = j276 277 !ERROR: At most one HINT clause can appear on the ATOMIC directive278 !$omp atomic hint(omp_sync_hint_contended) hint(omp_sync_hint_speculative) capture279 i = j280 j = k281 !$omp end atomic282 !ERROR: At most one HINT clause can appear on the ATOMIC directive283 !$omp atomic hint(omp_sync_hint_nonspeculative) capture hint(omp_sync_hint_nonspeculative)284 i = j285 j = k286 !$omp end atomic287 !ERROR: At most one HINT clause can appear on the ATOMIC directive288 !$omp atomic capture hint(omp_sync_hint_none) hint (omp_sync_hint_uncontended)289 i = j290 j = k291 !$omp end atomic292! 2.17.7.4293! If atomic-clause is read then memory-order-clause must not be acq_rel or release.294 295 !$omp atomic acq_rel read296 i = j297 !$omp atomic read acq_rel298 i = j299 300 !$omp atomic release read301 i = j302 !$omp atomic read release303 i = j304 305! 2.17.7.5306! If atomic-clause is write then memory-order-clause must not be acq_rel or acquire.307 308 !$omp atomic acq_rel write309 i = j310 !$omp atomic write acq_rel311 i = j312 313 !$omp atomic acquire write314 i = j315 !$omp atomic write acquire316 i = j317 318 319! 2.17.7.6320! If atomic-clause is update or not present then memory-order-clause must not be acq_rel or acquire.321 322 !$omp atomic acq_rel update323 !ERROR: The atomic variable i should appear as an argument in the update operation324 i = j325 !$omp atomic update acq_rel326 !ERROR: The atomic variable i should appear as an argument in the update operation327 i = j328 329 !$omp atomic acquire update330 !ERROR: The atomic variable i should appear as an argument in the update operation331 i = j332 333 !$omp atomic update acquire334 !ERROR: The atomic variable i should appear as an argument in the update operation335 i = j336 337 !$omp atomic acq_rel338 !ERROR: The atomic variable i should appear as an argument in the update operation339 i = j340 341 !$omp atomic acquire342 !ERROR: The atomic variable i should appear as an argument in the update operation343 i = j344end program345 346