| ! OpenMP offloading regression test that checks we do not cause a segfault when |
| ! implicitly mapping a not present optional allocatable function argument and |
| ! utilise it in the target region. 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 |
| real(4), allocatable, optional, intent(in) :: a(:) |
| real(4), intent(out) :: b(:) |
| write(*,*) "a is present" |
| write(*,*) "a is not present" |
| !$omp target teams distribute parallel do shared(a,b,ia) |
| real(4), allocatable :: a(:) |
| real(4), allocatable :: b(:) |
| !$omp target data map(from: b) |
| print *, "success, no segmentation fault" |
| !CHECK: success, no segmentation fault |