mirror of
https://github.com/autc04/Retro68.git
synced 2024-11-30 19:53:46 +00:00
23 lines
387 B
Fortran
23 lines
387 B
Fortran
|
! { 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
|