1! Offloading test checking interaction of allocatables with multi-dimensional
2! bounds (3-D in this case) and a target region
3! REQUIRES: flang, amdgpu
4
5! RUN: %libomptarget-compile-fortran-run-and-check-generic
6program main
7    integer, allocatable :: inArray(:,:,:)
8    integer, allocatable :: outArray(:,:,:)
9
10    allocate(inArray(3,3,3))
11    allocate(outArray(3,3,3))
12
13    do i = 1, 3
14      do j = 1, 3
15        do k = 1, 3
16            inArray(i, j, k) = 42
17            outArray(i, j, k) = 0
18        end do
19       end do
20    end do
21
22!$omp target map(tofrom:inArray(1:3, 1:3, 2:2), outArray(1:3, 1:3, 1:3))
23    do j = 1, 3
24      do k = 1, 3
25        outArray(k, j, 2) = inArray(k, j, 2)
26      end do
27    end do
28!$omp end target
29
30print *, outArray
31
32deallocate(inArray)
33deallocate(outArray)
34
35end program
36
37! CHECK: 0 0 0 0 0 0 0 0 0 42 42 42 42 42 42 42 42 42 0 0 0 0 0 0 0 0 0
38