This PR is one in a series of 3 that aim to add support for explicit member mapping of allocatable components in derived types within OpenMP+Fortran for Flang. This PR provides all of the runtime tests that are currently upstreamable, unfortunately some of the other tests would require linking of the fortran runtime for offload which we currently do not do. But regardless, this is plenty to ensure that the mapping is working in most cases.
39 lines
653 B
Fortran
39 lines
653 B
Fortran
! Offloading test checking interaction of allocatables with enter, exit and
|
|
! target
|
|
! REQUIRES: flang, amdgpu
|
|
|
|
! RUN: %libomptarget-compile-fortran-run-and-check-generic
|
|
program main
|
|
integer, allocatable :: A(:)
|
|
allocate(A(10))
|
|
|
|
!$omp target enter data map(alloc: A)
|
|
|
|
!$omp target
|
|
do I = 1, 10
|
|
A(I) = I
|
|
end do
|
|
!$omp end target
|
|
|
|
!$omp target exit data map(from: A)
|
|
|
|
!$omp target exit data map(delete: A)
|
|
|
|
do i = 1, 10
|
|
print *, A(i)
|
|
end do
|
|
|
|
deallocate(A)
|
|
end program
|
|
|
|
! CHECK: 1
|
|
! CHECK: 2
|
|
! CHECK: 3
|
|
! CHECK: 4
|
|
! CHECK: 5
|
|
! CHECK: 6
|
|
! CHECK: 7
|
|
! CHECK: 8
|
|
! CHECK: 9
|
|
! CHECK: 10
|