blob: e0cdddb8e1bf71185b5adc518ab3173fc5b0d35f (
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
|
! OpenMP offloading test that checks we do not cause a segfault when mapping
! optional function arguments (present or otherwise). No results requiring
! checking other than that the program compiles and runs to completion with no
! error.
! REQUIRES: flang, amdgpu
! RUN: %libomptarget-compile-fortran-run-and-check-generic
module foo
implicit none
contains
subroutine test(I,A)
implicit none
real(4), optional, intent(inout) :: A(:)
integer(kind=4), intent(in) :: I
!$omp target data map(to: A) if (I>0)
!$omp end target data
!$omp target enter data map(to:A) if (I>0)
!$omp target exit data map(from:A) if (I>0)
end subroutine test
end module foo
program main
use foo
implicit none
real :: array(10)
call test(0)
call test(1)
call test(0, array)
call test(1, array)
print *, "PASSED"
end program main
! CHECK: PASSED
|