Skip to content

Commit 292203e

Browse files
Add a test
1 parent eebd6c6 commit 292203e

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp -fopenmp-version=52
2+
!
3+
! OpenMP Version 5.2
4+
!
5+
! 2.10.2 single Construct
6+
! Valid and invalid testcases for copyprivate and nowait clause on the single directive
7+
8+
program single
9+
! Valid testcases
10+
!$omp single
11+
print *, x
12+
!$omp end single
13+
14+
!$omp single nowait
15+
print *, x
16+
!$omp end single
17+
18+
!$omp single copyprivate(x, y, z)
19+
print *, x
20+
!$omp end single
21+
22+
!$omp single
23+
print *, x
24+
!$omp end single copyprivate(x)
25+
26+
! Invalid testcases
27+
!$omp single
28+
print *, x
29+
!ERROR: NOWAIT clause must not be used with COPYPRIVATE clause on the SINGLE directive
30+
!$omp end single copyprivate(x) nowait
31+
32+
!ERROR: 'x' appears in more than one COPYPRIVATE clause on the SINGLE directive
33+
!$omp single copyprivate(x) copyprivate(x)
34+
print *, x
35+
!$omp end single
36+
37+
!$omp single
38+
print *, x
39+
!ERROR: 'x' appears in more than one COPYPRIVATE clause on the END SINGLE directive
40+
!$omp end single copyprivate(x) copyprivate(x)
41+
42+
!ERROR: At most one NOWAIT clause can appear on the SINGLE directive
43+
!$omp single nowait nowait
44+
print *, x
45+
!$omp end single
46+
47+
!$omp single
48+
print *, x
49+
!ERROR: At most one NOWAIT clause can appear on the END SINGLE directive
50+
!$omp end single nowait nowait
51+
52+
!ERROR: NOWAIT clause must not be used with COPYPRIVATE clause on the SINGLE directive
53+
!$omp single copyprivate(x) nowait
54+
print *, x
55+
!WARNING: The COPYPRIVATE clause with 'x' is already used on the SINGLE directive
56+
!WARNING: NOWAIT clause is already used on the SINGLE directive
57+
!$omp end single copyprivate(x) nowait
58+
59+
!$omp single copyprivate(x)
60+
print *, x
61+
!WARNING: The COPYPRIVATE clause with 'x' is already used on the SINGLE directive
62+
!ERROR: NOWAIT clause must not be used with COPYPRIVATE clause on the SINGLE directive
63+
!$omp end single copyprivate(x) nowait
64+
65+
!ERROR: NOWAIT clause must not be used with COPYPRIVATE clause on the SINGLE directive
66+
!$omp single copyprivate(x, y) nowait
67+
print *, x
68+
!WARNING: The COPYPRIVATE clause with 'x' is already used on the SINGLE directive
69+
!ERROR: 'z' appears in more than one COPYPRIVATE clause on the END SINGLE directive
70+
!WARNING: NOWAIT clause is already used on the SINGLE directive
71+
!$omp end single copyprivate(x, z) copyprivate(z) nowait
72+
73+
!ERROR: NOWAIT clause must not be used with COPYPRIVATE clause on the SINGLE directive
74+
!$omp single copyprivate(x) nowait copyprivate(y) copyprivate(z)
75+
print *, x
76+
!WARNING: The COPYPRIVATE clause with 'x' is already used on the SINGLE directive
77+
!WARNING: The COPYPRIVATE clause with 'y' is already used on the SINGLE directive
78+
!WARNING: The COPYPRIVATE clause with 'z' is already used on the SINGLE directive
79+
!WARNING: NOWAIT clause is already used on the SINGLE directive
80+
!$omp end single copyprivate(x, y, z) nowait
81+
end program

0 commit comments

Comments
 (0)