37 lines · plain
1! OpenMP offloading test that checks we do not cause a segfault when mapping2! optional function arguments (present or otherwise). No results requiring3! checking other than that the program compiles and runs to completion with no4! error.5! REQUIRES: flang, amdgpu6 7! RUN: %libomptarget-compile-fortran-run-and-check-generic8module foo9 implicit none10 contains11 subroutine test(I,A)12 implicit none13 real(4), optional, intent(inout) :: A(:)14 integer(kind=4), intent(in) :: I15 16 !$omp target data map(to: A) if (I>0)17 !$omp end target data18 19 !$omp target enter data map(to:A) if (I>0)20 21 !$omp target exit data map(from:A) if (I>0)22 end subroutine test23end module foo24 25program main26 use foo27 implicit none28 real :: array(10)29 call test(0)30 call test(1)31 call test(0, array)32 call test(1, array)33 print *, "PASSED"34end program main35 36! CHECK: PASSED37