collapse-4.f90 934 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ! { dg-do run }
  2. ! collapse3.f90:test1
  3. program collapse4
  4. integer :: i, j, k, a(1:7, -3:5, 12:19), b(1:7, -3:5, 12:19)
  5. logical :: l, r
  6. l = .false.
  7. r = .false.
  8. a(:, :, :) = 0
  9. b(:, :, :) = 0
  10. !$acc parallel
  11. !$acc loop collapse (3) reduction (.or.:l)
  12. do i = 2, 6
  13. do j = -2, 4
  14. do k = 13, 18
  15. l = l.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4
  16. l = l.or.k.lt.13.or.k.gt.18
  17. if (.not.l) a(i, j, k) = a(i, j, k) + 1
  18. end do
  19. end do
  20. end do
  21. !$acc end parallel
  22. do i = 2, 6
  23. do j = -2, 4
  24. do k = 13, 18
  25. r = r.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4
  26. r = r.or.k.lt.13.or.k.gt.18
  27. if (.not.l) b(i, j, k) = b(i, j, k) + 1
  28. end do
  29. end do
  30. end do
  31. if (l .neqv. r) call abort
  32. do i = 2, 6
  33. do j = -2, 4
  34. do k = 13, 18
  35. if (a(i, j, k) .ne. b(i, j, k)) call abort
  36. end do
  37. end do
  38. end do
  39. end program collapse4