xref: /llvm-project/offload/test/offloading/fortran/target-map-enter-exit-allocatables.f90 (revision 372344995568cae076477a8b0e98fcdec7c49379)
1! Offloading test checking interaction of allocatables with enter, exit and
2! target
3! REQUIRES: flang, amdgpu
4
5! RUN: %libomptarget-compile-fortran-run-and-check-generic
6program main
7    integer, allocatable :: A(:)
8    allocate(A(10))
9
10   !$omp target enter data map(alloc: A)
11
12    !$omp target
13        do I = 1, 10
14            A(I) = I
15        end do
16    !$omp end target
17
18    !$omp target exit data map(from: A)
19
20    !$omp target exit data map(delete: A)
21
22    do i = 1, 10
23        print *, A(i)
24    end do
25
26    deallocate(A)
27end program
28
29! CHECK: 1
30! CHECK: 2
31! CHECK: 3
32! CHECK: 4
33! CHECK: 5
34! CHECK: 6
35! CHECK: 7
36! CHECK: 8
37! CHECK: 9
38! CHECK: 10
39