105 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp2! OpenMP Version 4.53! 2.7.1 Loop Construct4! The loop iteration variable may not appear in a threadprivate directive.5 6 7subroutine omp_do8 integer, save:: i, j, k,n9 !$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, 1013 !ERROR: Loop iteration variable j is not allowed in THREADPRIVATE.14 do j = 1, 1015 print *, "Hello"16 end do17 end do18 !$omp end do19end subroutine omp_do20 21subroutine omp_do122 integer, save :: i, j, k23 !$omp threadprivate(k,j,i)24 !$omp do25 !ERROR: Loop iteration variable i is not allowed in THREADPRIVATE.26 do i = 1, 1027 do j = 1, 1028 print *, "Hello"29 end do30 end do31 !$omp end do32 33end subroutine omp_do134 35subroutine omp_do236 integer, save :: k, j37 !$omp threadprivate(k)38 !$omp threadprivate(j)39 call compute()40 contains41 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, 1045 do i = 1, 1046 print *, "Hello"47 end do48 end do foo49 !$omp end do50 end subroutine51 52end subroutine omp_do253 54subroutine omp_do355 integer, save :: i56 !$omp threadprivate(i)57 !$omp parallel58 print *, "parallel"59 !$omp end parallel60 !$omp do61 !ERROR: Loop iteration variable i is not allowed in THREADPRIVATE.62 do i = 1, 1063 do j = 1, 1064 print *, "Hello"65 end do66 end do67 !$omp end do68 69end subroutine omp_do370 71module tp72 !integer i,j73 integer, save:: i, j, k,n74 !$omp threadprivate(i)75 !$omp threadprivate(j)76end module tp77 78module usetp79 use tp80end module usetp81 82subroutine main83 use usetp84 !$omp do85 !ERROR: Loop iteration variable i is not allowed in THREADPRIVATE.86 do i = 1, 1087 do j = 1, 1088 print *, "Hello"89 end do90 end do91 !$omp end do92end subroutine93 94subroutine main195 use tp96 !$omp do97 !ERROR: Loop iteration variable j is not allowed in THREADPRIVATE.98 do j = 1, 1099 do i = 1, 10100 print *, "Hello"101 end do102 end do103 !$omp end do104end subroutine105