aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.oacc-fortran/routine-2.f90
blob: 3d418b660c52b08e2aad3b2a49cff19614e665fd (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
! { dg-do run }
! { dg-options "-fno-inline" }

  module m1
    contains
    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
  end module m1
  use m1
  integer, parameter :: n = 10
  integer :: a(n), i
  !$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)) call abort
  end do
end