summaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.fortran/examples-4/e.53.2.f90
blob: 5bc900cac80f03f9e4af73e50a6c86656d0e8c42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
! { dg-do run }

program e_53_2
  !$omp declare target (fib)
  integer :: x, fib
  !$omp target
    x = fib (25)
  !$omp end target
  if (x /= fib (25)) call abort
end program

integer recursive function fib (n) result (f)
  !$omp declare target
  integer :: n
  if (n <= 0) then
    f = 0
  else if (n == 1) then
    f = 1
  else
    f = fib (n - 1) + fib (n - 2)
  end if
end function