mirror of
https://github.com/autc04/Retro68.git
synced 2024-12-23 10:31:22 +00:00
28 lines
502 B
Fortran
28 lines
502 B
Fortran
! { dg-do run }
|
|
! { dg-options "-fno-inline" }
|
|
|
|
integer, parameter :: n = 10
|
|
integer :: a(n), i
|
|
integer, external :: fact
|
|
!$acc routine (fact)
|
|
!$acc parallel
|
|
!$acc loop
|
|
do i = 1, n
|
|
a(i) = fact (i)
|
|
end do
|
|
!$acc end parallel
|
|
do i = 1, n
|
|
if (a(i) .ne. fact(i)) STOP 1
|
|
end do
|
|
end
|
|
recursive function fact (x) result (res)
|
|
!$acc routine
|
|
integer, intent(in) :: x
|
|
integer :: res
|
|
if (x < 1) then
|
|
res = 1
|
|
else
|
|
res = x * fact (x - 1)
|
|
end if
|
|
end function fact
|