aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.fortran/declare-target-indirect-1.f90
blob: 39a91dfcdcacc2d118617ff633a8653245247d53 (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
36
37
38
39
! { dg-do run }

module m
contains
  integer function foo ()
    !$omp declare target to (foo) indirect
    foo = 5
  end function

  integer function bar ()
    !$omp declare target to (bar) indirect
    bar = 8
  end function

  integer function baz ()
    !$omp declare target to (baz) indirect
    baz = 11
  end function
end module

program main
  use m
  implicit none

  integer :: x, expected
  procedure (foo), pointer :: foo_ptr, bar_ptr, baz_ptr

  foo_ptr => foo
  bar_ptr => bar
  baz_ptr => baz

  expected = foo () + bar () + baz ()

  !$omp target map (to: foo_ptr, bar_ptr, baz_ptr) map (from: x)
    x = foo_ptr () + bar_ptr () + baz_ptr ()
  !$omp end target

  stop x - expected
end program