[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / omp-do04.f90
blob41709dd6d2a3c84cb8781f8643ae42c72459fc0c
1 ! RUN: %S/test_errors.sh %s %t %flang_fc1 -fopenmp
2 ! REQUIRES: shell
3 ! OpenMP Version 4.5
4 ! 2.7.1 Loop Construct
5 ! The loop iteration variable may not appear in a threadprivate directive.
8 program omp_do
9 integer, save:: i, j, k,n
10 !$omp threadprivate(k,j,i)
11 !$omp do collapse(2)
12 !ERROR: Loop iteration variable i is not allowed in THREADPRIVATE.
13 do i = 1, 10
14 !ERROR: Loop iteration variable j is not allowed in THREADPRIVATE.
15 do j = 1, 10
16 print *, "Hello"
17 end do
18 end do
19 !$omp end do
20 end program omp_do
22 program omp_do1
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 program omp_do1
35 program omp_do2
36 !$omp threadprivate(k)
37 !$omp threadprivate(j)
38 call compute()
39 contains
40 subroutine compute()
41 !$omp do ordered(1) collapse(1)
42 !ERROR: Loop iteration variable k is not allowed in THREADPRIVATE.
43 foo: do k = 1, 10
44 do i = 1, 10
45 print *, "Hello"
46 end do
47 end do foo
48 !$omp end do
49 end subroutine
51 end program omp_do2
53 program omp_do3
54 !$omp threadprivate(i)
55 !$omp parallel
56 print *, "parallel"
57 !$omp end parallel
58 !$omp do
59 !ERROR: Loop iteration variable i is not allowed in THREADPRIVATE.
60 do i = 1, 10
61 do j = 1, 10
62 print *, "Hello"
63 end do
64 end do
65 !$omp end do
67 end program omp_do3
69 module tp
70 !integer i,j
71 integer, save:: i, j, k,n
72 !$omp threadprivate(i)
73 !$omp threadprivate(j)
74 end module tp
76 module usetp
77 use tp
78 end module usetp
80 program main
81 use usetp
82 !$omp do
83 !ERROR: Loop iteration variable i is not allowed in THREADPRIVATE.
84 do i = 1, 10
85 do j = 1, 10
86 print *, "Hello"
87 end do
88 end do
89 !$omp end do
90 end program
92 program main1
93 use tp
94 !$omp do
95 !ERROR: Loop iteration variable j is not allowed in THREADPRIVATE.
96 do j = 1, 10
97 do i = 1, 10
98 print *, "Hello"
99 end do
100 end do
101 !$omp end do
102 end program