1! { dg-do run } 2 3! collapse3.f90:test2 4program collapse5 5 integer :: i, j, k, a(1:7, -3:5, 12:19), b(1:7, -3:5, 12:19) 6 integer :: v1, v2, v3, v4, v5, v6 7 logical :: l, r 8 l = .false. 9 r = .false. 10 a(:, :, :) = 0 11 b(:, :, :) = 0 12 v1 = 3 13 v2 = 6 14 v3 = -2 15 v4 = 4 16 v5 = 13 17 v6 = 18 18 !$acc parallel 19 !$acc loop collapse (3) reduction (.or.:l) 20 do i = v1, v2 21 do j = v3, v4 22 do k = v5, v6 23 l = l.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4 24 l = l.or.k.lt.13.or.k.gt.18 25 if (.not.l) a(i, j, k) = a(i, j, k) + 1 26 m = i * 100 + j * 10 + k 27 end do 28 end do 29 end do 30 !$acc end parallel 31 do i = v1, v2 32 do j = v3, v4 33 do k = v5, v6 34 r = r.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4 35 r = r.or.k.lt.13.or.k.gt.18 36 if (.not.l) b(i, j, k) = b(i, j, k) + 1 37 end do 38 end do 39 end do 40 if (l .neqv. r) STOP 1 41 do i = v1, v2 42 do j = v3, v4 43 do k = v5, v6 44 if (a(i, j, k) .ne. b(i, j, k)) STOP 2 45 end do 46 end do 47 end do 48end program collapse5 49