111 lines · plain
1! REQUIRES: openmp_runtime2 3! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=504! Semantic checks on hint clauses, as they appear on atomic constructs5 6program sample7 use omp_lib8 integer :: x, y9 logical :: z10 real :: k11 integer :: p(1)12 integer, parameter :: a = 113 !$omp atomic hint(1) write14 y = 215 16 !$omp atomic read hint(2)17 y = x 18 19 !ERROR: The synchronization hint is not valid20 !$omp atomic hint(3)21 y = y + 1022 23 !$omp atomic update hint(5)24 y = x + y25 26 !ERROR: The synchronization hint is not valid27 !$omp atomic hint(7) capture28 !WARNING: In ATOMIC UPDATE operation with CAPTURE either statement could be the update and the capture, assuming the first one is the capture statement29 y = x30 x = y31 !$omp end atomic32 33 !ERROR: Synchronization hint must be a constant integer value34 !ERROR: Must be a constant value35 !$omp atomic update hint(x)36 y = y * 137 38 !$omp atomic read hint(4)39 y = x40 41 !$omp atomic hint(8)42 x = x * y43 44 !$omp atomic write hint(omp_sync_hint_uncontended)45 x = 10 * y46 47 !$omp atomic hint(omp_lock_hint_speculative)48 x = y + x49 50 !ERROR: Synchronization hint must be a constant integer value51 !ERROR: Must be a constant value52 !$omp atomic hint(omp_sync_hint_uncontended + omp_sync_hint) read53 y = x 54 55 !$omp atomic hint(omp_sync_hint_nonspeculative)56 y = y * 957 58 !$omp atomic hint(omp_sync_hint_none) read59 y = x60 61 !$omp atomic read hint(omp_sync_hint_uncontended + omp_lock_hint_speculative)62 y = x63 64 !$omp atomic hint(omp_lock_hint_nonspeculative + omp_lock_hint_uncontended)65 x = x * y66 67 !$omp atomic write hint(omp_lock_hint_contended + omp_sync_hint_speculative)68 x = 10 * y69 70 !$omp atomic hint(omp_lock_hint_contended + omp_sync_hint_nonspeculative)71 x = y + x72 73 !ERROR: The synchronization hint is not valid74 !$omp atomic hint(omp_sync_hint_uncontended + omp_sync_hint_contended) read75 y = x 76 77 !ERROR: The synchronization hint is not valid78 !$omp atomic hint(omp_sync_hint_nonspeculative + omp_lock_hint_speculative)79 y = y * 980 81 !ERROR: Synchronization hint must be a constant integer value82 !ERROR: Must have INTEGER type, but is REAL(4)83 !$omp atomic hint(1.0) read84 y = x85 86 !ERROR: Synchronization hint must be a constant integer value87 !ERROR: Operands of + must be numeric; have LOGICAL(4) and INTEGER(4)88 !$omp atomic hint(z + omp_sync_hint_nonspeculative) read89 y = x90 91 !ERROR: Synchronization hint must be a constant integer value92 !ERROR: Must be a constant value93 !$omp atomic hint(k + omp_sync_hint_speculative) read94 y = x95 96 !ERROR: Synchronization hint must be a constant integer value97 !ERROR: Must be a constant value98 !$omp atomic hint(p(1) + omp_sync_hint_uncontended) write99 x = 10 * y100 101 !$omp atomic write hint(a)102 !ERROR: Within atomic operation x and y+x access the same storage103 x = y + x104 105 !$omp atomic hint(abs(-1)) write106 x = 7107 108 !$omp atomic hint(omp_sync_hint_uncontended + omp_sync_hint_uncontended + omp_sync_hint_speculative) write109 x = 7110end program111