summaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorcesar <cesar@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-14 13:44:17 +0000
committercesar <cesar@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-14 13:44:17 +0000
commiteae3d58955c5577cc105829a81882dca5b48455f (patch)
treefd4a4a91473cffc90c7a2d4498805190de428f88 /libgomp
parent81cf35e4285a6456826d6a41535fc5f71a276f9d (diff)
downloadgcc-eae3d58955c5577cc105829a81882dca5b48455f.tar.gz
PR middle-end/70643
gcc/ * omp-low.c (lower_oacc_reductions): Check for TREE_CONSTANT when building a mem ref for the incoming reduction variable. libgomp/ * testsuite/libgomp.oacc-fortran/pr70643.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234973 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog5
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/pr70643.f9051
2 files changed, 56 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index d4411c0f557..89ee866ac4c 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,8 @@
+2016-04-14 Cesar Philippidis <cesar@codesourcery.com>
+
+ PR middle-end/70643
+ * testsuite/libgomp.oacc-fortran/pr70643.f90: New test.
+
2016-04-13 Cesar Philippidis <cesar@codesourcery.com>
PR testsuite/68242
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/pr70643.f90 b/libgomp/testsuite/libgomp.oacc-fortran/pr70643.f90
new file mode 100644
index 00000000000..7c2e5eef904
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-fortran/pr70643.f90
@@ -0,0 +1,51 @@
+MODULE reduction_test
+
+CONTAINS
+
+SUBROUTINE reduction_kernel(x_min,x_max,y_min,y_max,arr,sum)
+
+ IMPLICIT NONE
+
+ INTEGER :: x_min,x_max,y_min,y_max
+ REAL(KIND=8), DIMENSION(x_min-2:x_max+2,y_min-2:y_max+2) :: arr
+ REAL(KIND=8) :: sum
+
+ INTEGER :: j,k
+
+!$ACC DATA PRESENT(arr) COPY(sum)
+!$ACC PARALLEL LOOP REDUCTION(+ : sum)
+ DO k=y_min,y_max
+ DO j=x_min,x_max
+ sum=sum+arr(j,k)
+ ENDDO
+ ENDDO
+!$ACC END PARALLEL LOOP
+!$ACC END DATA
+END SUBROUTINE reduction_kernel
+
+END MODULE reduction_test
+
+program main
+ use reduction_test
+
+ integer :: x_min,x_max,y_min,y_max
+ real(kind=8), dimension(1:10,1:10) :: arr
+ real(kind=8) :: sum
+
+ x_min = 1
+ x_max = 2
+ y_min = 1
+ y_max = 2
+
+ arr(:,:) = 1.0
+
+ sum = 0.0
+
+ !$acc data copy(arr)
+
+ call reduction_kernel(x_min,x_max,y_min,y_max,arr,sum)
+
+ !$acc end data
+
+ if (sum .ne. 4.0) call abort
+end program