collapse2.f90 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ! { dg-do run }
  2. program collapse2
  3. call test1
  4. call test2
  5. contains
  6. subroutine test1
  7. integer :: i, j, k, a(1:3, 4:6, 5:7)
  8. logical :: l
  9. l = .false.
  10. a(:, :, :) = 0
  11. !$omp parallel do collapse(4 - 1) schedule(static, 4)
  12. do 164 i = 1, 3
  13. do 164 j = 4, 6
  14. do 164 k = 5, 7
  15. a(i, j, k) = i + j + k
  16. 164 end do
  17. !$omp parallel do collapse(2) reduction(.or.:l)
  18. firstdo: do i = 1, 3
  19. do j = 4, 6
  20. do k = 5, 7
  21. if (a(i, j, k) .ne. (i + j + k)) l = .true.
  22. end do
  23. end do
  24. end do firstdo
  25. !$omp end parallel do
  26. if (l) call abort
  27. end subroutine test1
  28. subroutine test2
  29. integer :: a(3,3,3), k, kk, kkk, l, ll, lll
  30. !$omp do collapse(3)
  31. do 115 k=1,3
  32. dokk: do kk=1,3
  33. do kkk=1,3
  34. a(k,kk,kkk) = 1
  35. enddo
  36. enddo dokk
  37. 115 continue
  38. if (any(a(1:3,1:3,1:3).ne.1)) call abort
  39. !$omp do collapse(3)
  40. dol: do 120 l=1,3
  41. doll: do ll=1,3
  42. do lll=1,3
  43. a(l,ll,lll) = 2
  44. enddo
  45. enddo doll
  46. 120 end do dol
  47. if (any(a(1:3,1:3,1:3).ne.2)) call abort
  48. end subroutine test2
  49. end program collapse2