30 lines · plain
1! Offloading test that tests that if(present(a)) compiles and executes without2! causing any compilation errors, primarily a regression test that does not3! yield interesting results.4! REQUIRES: flang, amdgpu5 6! RUN: %libomptarget-compile-fortran-run-and-check-generic7module mod8 implicit none9contains10 subroutine routine(a)11 implicit none12 real, dimension(:), optional :: a13 integer :: i14 !$omp target data if(present(a)) map(alloc:a)15 do i = 1, 1016 a(i) = i17 end do18 !$omp end target data19 end subroutine routine20end module mod21 22program main23 use mod24 real :: a(10)25 call routine(a)26 print *, a27end program main28 29! CHECK: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.30