Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / OpenMP / do04.f90
blob6690f4927f6a9e85c7a6654a3de892e246649ed6
1 ! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
2 ! OpenMP Version 4.5
3 ! 2.7.1 Loop Construct
4 ! The loop iteration variable may not appear in a threadprivate directive.
7 subroutine omp_do
8 integer, save:: i, j, k,n
9 !$omp threadprivate(k,j,i)
10 !$omp do collapse(2)
11 !ERROR: Loop iteration variable i is not allowed in THREADPRIVATE.
12 do i = 1, 10
13 !ERROR: Loop iteration variable j is not allowed in THREADPRIVATE.
14 do j = 1, 10
15 print *, "Hello"
16 end do
17 end do
18 !$omp end do
19 end subroutine omp_do
21 subroutine omp_do1
22 integer, save :: i, j, k
23 !$omp threadprivate(k,j,i)
24 !$omp do
25 !ERROR: Loop iteration variable i is not allowed in THREADPRIVATE.
26 do i = 1, 10
27 do j = 1, 10
28 print *, "Hello"
29 end do
30 end do
31 !$omp end do
33 end subroutine omp_do1
35 subroutine omp_do2
36 integer, save :: k, j
37 !$omp threadprivate(k)
38 !$omp threadprivate(j)
39 call compute()
40 contains
41 subroutine compute()
42 !$omp do ordered(1) collapse(1)
43 !ERROR: Loop iteration variable k is not allowed in THREADPRIVATE.
44 foo: do k = 1, 10
45 do i = 1, 10
46 print *, "Hello"
47 end do
48 end do foo
49 !$omp end do
50 end subroutine
52 end subroutine omp_do2
54 subroutine omp_do3
55 integer, save :: i
56 !$omp threadprivate(i)
57 !$omp parallel
58 print *, "parallel"
59 !$omp end parallel
60 !$omp do
61 !ERROR: Loop iteration variable i is not allowed in THREADPRIVATE.
62 do i = 1, 10
63 do j = 1, 10
64 print *, "Hello"
65 end do
66 end do
67 !$omp end do
69 end subroutine omp_do3
71 module tp
72 !integer i,j
73 integer, save:: i, j, k,n
74 !$omp threadprivate(i)
75 !$omp threadprivate(j)
76 end module tp
78 module usetp
79 use tp
80 end module usetp
82 subroutine main
83 use usetp
84 !$omp do
85 !ERROR: Loop iteration variable i is not allowed in THREADPRIVATE.
86 do i = 1, 10
87 do j = 1, 10
88 print *, "Hello"
89 end do
90 end do
91 !$omp end do
92 end subroutine
94 subroutine main1
95 use tp
96 !$omp do
97 !ERROR: Loop iteration variable j is not allowed in THREADPRIVATE.
98 do j = 1, 10
99 do i = 1, 10
100 print *, "Hello"
101 end do
102 end do
103 !$omp end do
104 end subroutine