aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.fortran/declare-target-indirect-3.f90
blob: 00f33bd11704282ff35d6360a5429f4c583bc304 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
! { dg-do run }

! Check that indirect calls work on procedures passed in via a dummy argument

module m
  integer, parameter :: offset = 123
contains
  function bar(x)
    !$omp declare target enter (bar) indirect
    integer :: bar
    integer, intent(in) :: x
    bar = x + offset
  end function

  function foo(f, x)
    integer :: foo
    procedure(bar) :: f
    integer, intent(in) :: x

    !$omp target map (to: x) map (from: foo)
      foo = f(x)
    !$omp end target
  end function
end module

program main
  use m
  implicit none

  integer :: a = 321
  integer :: b

  b = foo(bar, a)
  stop b - (a + offset)
end program