Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / OpenMP / critical-hint-clause.f90
blob33088c6caf3598571444597a981e760a1a03531f
1 ! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
2 ! Semantic checks on hint clauses, as they appear on critical construct
4 program sample
5 use omp_lib
6 integer :: y
7 logical :: z
8 real :: k
9 integer :: p(1)
11 !$omp critical (name) hint(1)
12 y = 2
13 !$omp end critical (name)
15 !$omp critical (name) hint(2)
16 y = 2
17 !$omp end critical (name)
19 !ERROR: Hint clause value is not a valid OpenMP synchronization value
20 !$omp critical (name) hint(3)
21 y = 2
22 !$omp end critical (name)
24 !$omp critical (name) hint(5)
25 y = 2
26 !$omp end critical (name)
28 !ERROR: Hint clause value is not a valid OpenMP synchronization value
29 !$omp critical (name) hint(7)
30 y = 2
31 !$omp end critical (name)
33 !ERROR: Hint clause must have non-negative constant integer expression
34 !ERROR: Must be a constant value
35 !$omp critical (name) hint(x)
36 y = 2
37 !$omp end critical (name)
39 !$omp critical (name) hint(4)
40 y = 2
41 !$omp end critical (name)
43 !$omp critical (name) hint(8)
44 y = 2
45 !$omp end critical (name)
47 !$omp critical (name) hint(omp_sync_hint_uncontended)
48 y = 2
49 !$omp end critical (name)
51 !$omp critical (name) hint(omp_lock_hint_speculative)
52 y = 2
53 !$omp end critical (name)
55 !ERROR: Hint clause must have non-negative constant integer expression
56 !ERROR: Must be a constant value
57 !$omp critical (name) hint(omp_sync_hint_uncontended + omp_sync_hint)
58 y = 2
59 !$omp end critical (name)
61 !$omp critical (name) hint(omp_sync_hint_nonspeculative)
62 y = 2
63 !$omp end critical (name)
65 !$omp critical (name) hint(omp_sync_hint_none)
66 y = 2
67 !$omp end critical (name)
69 !$omp critical (name) hint(omp_sync_hint_uncontended + omp_lock_hint_speculative)
70 y = 2
71 !$omp end critical (name)
73 !$omp critical (name) hint(omp_lock_hint_nonspeculative + omp_lock_hint_uncontended)
74 y = 2
75 !$omp end critical (name)
77 !$omp critical (name) hint(omp_lock_hint_contended + omp_sync_hint_speculative)
78 y = 2
79 !$omp end critical (name)
81 !$omp critical (name) hint(omp_lock_hint_contended + omp_sync_hint_nonspeculative)
82 y = 2
83 !$omp end critical (name)
85 !ERROR: Hint clause value is not a valid OpenMP synchronization value
86 !$omp critical (name) hint(omp_sync_hint_uncontended + omp_sync_hint_contended)
87 y = 2
88 !$omp end critical (name)
90 !ERROR: Hint clause value is not a valid OpenMP synchronization value
91 !$omp critical (name) hint(omp_sync_hint_nonspeculative + omp_lock_hint_speculative)
92 y = 2
93 !$omp end critical (name)
95 !ERROR: Hint clause must have non-negative constant integer expression
96 !$omp critical (name) hint(1.0)
97 y = 2
98 !$omp end critical (name)
100 !ERROR: Hint clause must have non-negative constant integer expression
101 !ERROR: Operands of + must be numeric; have LOGICAL(4) and INTEGER(4)
102 !$omp critical (name) hint(z + omp_sync_hint_nonspeculative)
103 y = 2
104 !$omp end critical (name)
106 !ERROR: Hint clause must have non-negative constant integer expression
107 !ERROR: Must be a constant value
108 !$omp critical (name) hint(k + omp_sync_hint_speculative)
109 y = 2
110 !$omp end critical (name)
112 !ERROR: Hint clause must have non-negative constant integer expression
113 !ERROR: Must be a constant value
114 !$omp critical (name) hint(p(1) + omp_sync_hint_uncontended)
115 y = 2
116 !$omp end critical (name)
117 end program