[WebAssembly] Fix asan issue from https://reviews.llvm.org/D121349
[llvm-project.git] / flang / test / Semantics / omp-do04.f90
blob3ef7e7fb49525db7621a903d363d536924adacfd
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 program 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 program omp_do
21 program omp_do1
22 !$omp threadprivate(k,j,i)
23 !$omp do
24 !ERROR: Loop iteration variable i is not allowed in THREADPRIVATE.
25 do i = 1, 10
26 do j = 1, 10
27 print *, "Hello"
28 end do
29 end do
30 !$omp end do
32 end program omp_do1
34 program omp_do2
35 !$omp threadprivate(k)
36 !$omp threadprivate(j)
37 call compute()
38 contains
39 subroutine compute()
40 !$omp do ordered(1) collapse(1)
41 !ERROR: Loop iteration variable k is not allowed in THREADPRIVATE.
42 foo: do k = 1, 10
43 do i = 1, 10
44 print *, "Hello"
45 end do
46 end do foo
47 !$omp end do
48 end subroutine
50 end program omp_do2
52 program omp_do3
53 !$omp threadprivate(i)
54 !$omp parallel
55 print *, "parallel"
56 !$omp end parallel
57 !$omp do
58 !ERROR: Loop iteration variable i is not allowed in THREADPRIVATE.
59 do i = 1, 10
60 do j = 1, 10
61 print *, "Hello"
62 end do
63 end do
64 !$omp end do
66 end program omp_do3
68 module tp
69 !integer i,j
70 integer, save:: i, j, k,n
71 !$omp threadprivate(i)
72 !$omp threadprivate(j)
73 end module tp
75 module usetp
76 use tp
77 end module usetp
79 program main
80 use usetp
81 !$omp do
82 !ERROR: Loop iteration variable i is not allowed in THREADPRIVATE.
83 do i = 1, 10
84 do j = 1, 10
85 print *, "Hello"
86 end do
87 end do
88 !$omp end do
89 end program
91 program main1
92 use tp
93 !$omp do
94 !ERROR: Loop iteration variable j is not allowed in THREADPRIVATE.
95 do j = 1, 10
96 do i = 1, 10
97 print *, "Hello"
98 end do
99 end do
100 !$omp end do
101 end program