summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/goacc/reduction-2.f95
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/goacc/reduction-2.f95')
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/reduction-2.f9521
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/goacc/reduction-2.f95 b/gcc/testsuite/gfortran.dg/goacc/reduction-2.f95
new file mode 100644
index 00000000000..ffcec70c7ac
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/reduction-2.f95
@@ -0,0 +1,21 @@
+! { dg-do compile }
+
+program reduction
+ integer, parameter :: n = 40, c = 10
+ integer :: i, sum
+
+ call redsub (sum, n, c)
+end program reduction
+
+subroutine redsub(sum, n, c)
+ integer :: sum, n, c
+
+ sum = 0
+
+ !$acc parallel vector_length(n) copyin (n, c)
+ !$acc loop reduction(+:sum)
+ do i = 1, n
+ sum = sum + c
+ end do
+ !$acc end parallel
+end subroutine redsub