aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.oacc-fortran/routine-1.f90
diff options
context:
space:
mode:
Diffstat (limited to 'libgomp/testsuite/libgomp.oacc-fortran/routine-1.f90')
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/routine-1.f9032
1 files changed, 32 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/routine-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/routine-1.f90
new file mode 100644
index 00000000000..33905157d49
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-fortran/routine-1.f90
@@ -0,0 +1,32 @@
+! { dg-do run }
+! { dg-options "-fno-inline" }
+
+ interface
+ recursive function fact (x)
+ !$acc routine
+ integer, intent(in) :: x
+ integer :: fact
+ end function fact
+ end interface
+ 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
+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