aboutsummaryrefslogtreecommitdiff
path: root/offload/test/offloading/fortran/target-map-local-intrinisc-sized-param.f90
blob: b4fded7b3c70ac578857b93a01ed5d698a3a9e05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
! Offloading test checking interaction of an local array
! sized utilising an input parameter and the size intrinsic
! when being mapped to device.
! REQUIRES: flang, amdgpu

! RUN: %libomptarget-compile-fortran-run-and-check-generic
module mod
    use iso_fortran_env, only: real64
    implicit none
contains
    subroutine test(a)
        implicit none
        integer :: i
        real(kind=real64), dimension(:) :: a
        real(kind=real64), dimension(size(a, 1)) :: b

!$omp target map(tofrom: b)
        do i = 1, 10
            b(i) = i
        end do
!$omp end target

        print *, b
    end subroutine
end module mod

program main
    use mod
    real(kind=real64), allocatable :: a(:)
    allocate(a(10))

    do i = 1, 10
        a(i) = i
    end do

    call test(a)
end program main

!CHECK: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.