1! { dg-do run }
2
3program collapse2
4  integer :: i, j, k, a(1:3, 4:6, 5:7)
5  logical :: l
6  l = .false.
7  a(:, :, :) = 0
8  !$acc parallel
9  !$acc loop collapse(4 - 1)
10    do 164 i = 1, 3
11      do 164 j = 4, 6
12        do 164 k = 5, 7
13          a(i, j, k) = i + j + k
14164      end do
15  !$acc loop collapse(2) reduction(.or.:l)
16firstdo: do i = 1, 3
17      do j = 4, 6
18        do k = 5, 7
19          if (a(i, j, k) .ne. (i + j + k)) l = .true.
20        end do
21      end do
22    end do firstdo
23  !$acc end parallel
24  if (l) call abort
25end program collapse2
26