| 1 |
! { dg-do run } |
| 2 |
|
| 3 |
module m |
| 4 |
contains |
| 5 |
integer function foo () |
| 6 |
!$omp declare target to (foo) indirect |
| 7 |
foo = 5 |
| 8 |
end function |
| 9 |
|
| 10 |
integer function bar () |
| 11 |
!$omp declare target to (bar) indirect |
| 12 |
bar = 8 |
| 13 |
end function |
| 14 |
|
| 15 |
integer function baz () |
| 16 |
!$omp declare target to (baz) indirect |
| 17 |
baz = 11 |
| 18 |
end function |
| 19 |
end module |
| 20 |
|
| 21 |
program main |
| 22 |
use m |
| 23 |
implicit none |
| 24 |
|
| 25 |
integer :: x, expected |
| 26 |
procedure (foo), pointer :: foo_ptr, bar_ptr, baz_ptr |
| 27 |
|
| 28 |
foo_ptr => foo |
| 29 |
bar_ptr => bar |
| 30 |
baz_ptr => baz |
| 31 |
|
| 32 |
expected = foo () + bar () + baz () |
| 33 |
|
| 34 |
!$omp target map (to: foo_ptr, bar_ptr, baz_ptr) map (from: x) |
| 35 |
x = foo_ptr () + bar_ptr () + baz_ptr () |
| 36 |
!$omp end target |
| 37 |
|
| 38 |
stop x - expected |
| 39 |
end program |