PR c++/86342 - -Wdeprecated-copy and system headers.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-fortran / routine-9.f90
blobb1a1338dd8c87c66c1c057d3d7d1f2f8041e4336
1 ! { dg-do run }
2 ! { dg-options "-fno-inline" }
4 program main
5 implicit none
6 integer, parameter :: n = 10
7 integer :: a(n), i
8 integer, external :: fact
9 !$acc routine (fact)
10 !$acc parallel
11 !$acc loop
12 do i = 1, n
13 a(i) = fact (i)
14 end do
15 !$acc end parallel
16 do i = 1, n
17 if (a(i) .ne. fact(i)) STOP 1
18 end do
19 end program main
21 recursive function fact (x) result (res)
22 implicit none
23 !$acc routine (fact)
24 integer, intent(in) :: x
25 integer :: res
26 if (x < 1) then
27 res = 1
28 else
29 res = x * fact(x - 1)
30 end if
31 end function fact