| 1 |
! { dg-do run } |
| 2 |
|
| 3 |
! Check that indirect calls work on procedures passed in via a dummy argument |
| 4 |
|
| 5 |
module m |
| 6 |
integer, parameter :: offset = 123 |
| 7 |
contains |
| 8 |
function bar(x) |
| 9 |
!$omp declare target enter (bar) indirect |
| 10 |
integer :: bar |
| 11 |
integer, intent(in) :: x |
| 12 |
bar = x + offset |
| 13 |
end function |
| 14 |
|
| 15 |
function foo(f, x) |
| 16 |
integer :: foo |
| 17 |
procedure(bar) :: f |
| 18 |
integer, intent(in) :: x |
| 19 |
|
| 20 |
!$omp target map (to: x) map (from: foo) |
| 21 |
foo = f(x) |
| 22 |
!$omp end target |
| 23 |
end function |
| 24 |
end module |
| 25 |
|
| 26 |
program main |
| 27 |
use m |
| 28 |
implicit none |
| 29 |
|
| 30 |
integer :: a = 321 |
| 31 |
integer :: b |
| 32 |
|
| 33 |
b = foo(bar, a) |
| 34 |
stop b - (a + offset) |
| 35 |
end program |