1! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp 2! Semantic checks on hint clauses, as they appear on atomic constructs 3 4program sample 5 use omp_lib 6 integer :: x, y 7 logical :: z 8 real :: k 9 integer :: p(1) 10 integer, parameter :: a = 1 11 !$omp atomic hint(1) write 12 y = 2 13 14 !$omp atomic read hint(2) 15 y = x 16 17 !ERROR: Hint clause value is not a valid OpenMP synchronization value 18 !$omp atomic hint(3) 19 y = y + 10 20 21 !$omp atomic update hint(5) 22 y = x 23 24 !ERROR: Hint clause value is not a valid OpenMP synchronization value 25 !$omp atomic hint(7) capture 26 y = x 27 x = y 28 !$omp end atomic 29 30 !ERROR: Hint clause must have non-negative constant integer expression 31 !ERROR: Must be a constant value 32 !$omp atomic update hint(x) 33 y = y * 1 34 35 !$omp atomic read hint(4) 36 y = x 37 38 !$omp atomic hint(8) 39 x = x * y 40 41 !$omp atomic write hint(omp_sync_hint_uncontended) 42 x = 10 * y 43 44 !$omp atomic hint(omp_lock_hint_speculative) 45 x = y + x 46 47 !ERROR: Hint clause must have non-negative constant integer expression 48 !ERROR: Must be a constant value 49 !$omp atomic hint(omp_sync_hint_uncontended + omp_sync_hint) read 50 y = x 51 52 !$omp atomic hint(omp_sync_hint_nonspeculative) 53 y = y * 9 54 55 !$omp atomic hint(omp_sync_hint_none) read 56 y = x 57 58 !$omp atomic read hint(omp_sync_hint_uncontended + omp_lock_hint_speculative) 59 y = x 60 61 !$omp atomic hint(omp_lock_hint_nonspeculative + omp_lock_hint_uncontended) 62 x = x * y 63 64 !$omp atomic write hint(omp_lock_hint_contended + omp_sync_hint_speculative) 65 x = 10 * y 66 67 !$omp atomic hint(omp_lock_hint_contended + omp_sync_hint_nonspeculative) 68 x = y + x 69 70 !ERROR: Hint clause value is not a valid OpenMP synchronization value 71 !$omp atomic hint(omp_sync_hint_uncontended + omp_sync_hint_contended) read 72 y = x 73 74 !ERROR: Hint clause value is not a valid OpenMP synchronization value 75 !$omp atomic hint(omp_sync_hint_nonspeculative + omp_lock_hint_speculative) 76 y = y * 9 77 78 !ERROR: Hint clause must have non-negative constant integer expression 79 !$omp atomic hint(1.0) read 80 y = x 81 82 !ERROR: Hint clause must have non-negative constant integer expression 83 !ERROR: Operands of + must be numeric; have LOGICAL(4) and INTEGER(4) 84 !$omp atomic hint(z + omp_sync_hint_nonspeculative) read 85 y = x 86 87 !ERROR: Hint clause must have non-negative constant integer expression 88 !ERROR: Must be a constant value 89 !$omp atomic hint(k + omp_sync_hint_speculative) read 90 y = x 91 92 !ERROR: Hint clause must have non-negative constant integer expression 93 !ERROR: Must be a constant value 94 !$omp atomic hint(p(1) + omp_sync_hint_uncontended) write 95 x = 10 * y 96 97 !$omp atomic write hint(a) 98 x = y + x 99 100 !$omp atomic hint(abs(-1)) write 101 x = 7 102 103 !$omp atomic hint(omp_sync_hint_uncontended + omp_sync_hint_uncontended + omp_sync_hint_speculative) write 104 x = 7 105end program 106