Debian Codegraph @

flang/test/Semantics/OpenMP/critical-hint-clause.f90

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