aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChung-Lin Tang <cltang@codesourcery.com>2016-07-29 15:42:06 +0000
committerChung-Lin Tang <cltang@codesourcery.com>2016-07-29 15:42:06 +0000
commitf41683656f1fa7270117c5eaadeb77c8c8c3ec2b (patch)
treea8eb2f5f400a668a6fd2d56c456a2e095f2fbae2
parent31d82ded1b4122e3603d2a52ae285678fe8db858 (diff)
2016-07-29 Chung-Lin Tang <cltang@codesourcery.com>
gcc/ * fortran/openmp.c (resolve_omp_clauses): Adjust use_device clause handling to only allow pointers and arrays. gcc/testsuite/ * gfortran.dg/goacc/host_data-tree.f95: Adjust to use accept pointers in use_device clause. * gfortran.dg/goacc/uninit-use-device-clause.f95: Likewise. * gfortran.dg/goacc/list.f95: Adjust to catch "neither a pointer nor an array" error messages. libgomp/testsuite/ * libgomp.oacc-fortran/host_data-1.f90: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@238875 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog.gomp6
-rw-r--r--gcc/fortran/openmp.c19
-rw-r--r--gcc/testsuite/ChangeLog.gomp9
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/host_data-tree.f956
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/list.f9518
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/uninit-use-device-clause.f954
-rw-r--r--libgomp/ChangeLog.gomp4
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/host_data-1.f9016
8 files changed, 58 insertions, 24 deletions
diff --git a/gcc/fortran/ChangeLog.gomp b/gcc/fortran/ChangeLog.gomp
index dfecbf87cea..8744607e2a2 100644
--- a/gcc/fortran/ChangeLog.gomp
+++ b/gcc/fortran/ChangeLog.gomp
@@ -1,3 +1,9 @@
+2016-07-29 Chung-Lin Tang <cltang@codesourcery.com>
+
+ PR fortran/70598
+ * openmp.c (resolve_omp_clauses): Adjust use_device clause
+ handling to only allow pointers and arrays.
+
2016-07-28 Cesar Philippidis <cesar@codesourcery.com>
PR fortran/72741
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index 3c39836a465..e463df778f7 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -3932,17 +3932,24 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
&& CLASS_DATA (n->sym)->attr.allocatable))
gfc_error ("ALLOCATABLE object %qs in %s clause at %L",
n->sym->name, name, &n->where);
- if (n->sym->attr.pointer
- || (n->sym->ts.type == BT_CLASS && CLASS_DATA (n->sym)
- && CLASS_DATA (n->sym)->attr.class_pointer))
- gfc_error ("POINTER object %qs in %s clause at %L",
- n->sym->name, name, &n->where);
+ if (n->sym->ts.type == BT_CLASS
+ && CLASS_DATA (n->sym)
+ && CLASS_DATA (n->sym)->attr.class_pointer)
+ gfc_error ("POINTER object %qs of polymorphic type in "
+ "%s clause at %L", n->sym->name, name,
+ &n->where);
if (n->sym->attr.cray_pointer)
gfc_error ("Cray pointer object %qs in %s clause at %L",
n->sym->name, name, &n->where);
- if (n->sym->attr.cray_pointee)
+ else if (n->sym->attr.cray_pointee)
gfc_error ("Cray pointee object %qs in %s clause at %L",
n->sym->name, name, &n->where);
+ else if (n->sym->attr.flavor == FL_VARIABLE
+ && !n->sym->as
+ && !n->sym->attr.pointer)
+ gfc_error ("%s clause variable %qs at %L is neither "
+ "a POINTER nor an array", name,
+ n->sym->name, &n->where);
/* FALLTHRU */
case OMP_LIST_DEVICE_RESIDENT:
check_symbol_not_pointer (n->sym, n->where, name);
diff --git a/gcc/testsuite/ChangeLog.gomp b/gcc/testsuite/ChangeLog.gomp
index 1b63406ff78..b197955ccdd 100644
--- a/gcc/testsuite/ChangeLog.gomp
+++ b/gcc/testsuite/ChangeLog.gomp
@@ -1,3 +1,12 @@
+2016-07-29 Chung-Lin Tang <cltang@codesourcery.com>
+
+ PR fortran/70598
+ * gfortran.dg/goacc/host_data-tree.f95: Adjust to use
+ accept pointers in use_device clause.
+ * gfortran.dg/goacc/uninit-use-device-clause.f95: Likewise.
+ * gfortran.dg/goacc/list.f95: Adjust to catch "neither a
+ POINTER nor an array" error messages.
+
2016-07-28 Cesar Philippidis <cesar@codesourcery.com>
PR fortran/72741
diff --git a/gcc/testsuite/gfortran.dg/goacc/host_data-tree.f95 b/gcc/testsuite/gfortran.dg/goacc/host_data-tree.f95
index 4a11b9dcbcb..d44ca587051 100644
--- a/gcc/testsuite/gfortran.dg/goacc/host_data-tree.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/host_data-tree.f95
@@ -3,9 +3,9 @@
program test
implicit none
- integer :: i = 1
+ integer, pointer :: p
- !$acc host_data use_device(i)
+ !$acc host_data use_device(p)
!$acc end host_data
end program test
-! { dg-final { scan-tree-dump-times "pragma acc host_data use_device_ptr\\(i\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "pragma acc host_data use_device_ptr\\(p\\)" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/goacc/list.f95 b/gcc/testsuite/gfortran.dg/goacc/list.f95
index a8006bcdd84..87c84085b13 100644
--- a/gcc/testsuite/gfortran.dg/goacc/list.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/list.f95
@@ -76,19 +76,19 @@ program test
!$acc parallel private (i) firstprivate (i) ! { dg-error "present on multiple clauses" }
!$acc end parallel
- !$acc host_data use_device(i)
+ !$acc host_data use_device(i) ! { dg-error "neither a POINTER nor an array" }
!$acc end host_data
- !$acc host_data use_device(c, d)
+ !$acc host_data use_device(c, d) ! { dg-error "neither a POINTER nor an array" }
!$acc end host_data
!$acc host_data use_device(a)
!$acc end host_data
- !$acc host_data use_device(i, j, k, l, a)
+ !$acc host_data use_device(i, j, k, l, a) ! { dg-error "neither a POINTER nor an array" }
!$acc end host_data
- !$acc host_data use_device (i) use_device (j)
+ !$acc host_data use_device (i) use_device (j) ! { dg-error "neither a POINTER nor an array" }
!$acc end host_data
!$acc host_data use_device ! { dg-error "Unclassifiable OpenACC directive" }
@@ -99,13 +99,17 @@ program test
!$acc host_data use_device(10) ! { dg-error "Syntax error" }
- !$acc host_data use_device(/b/, /b/) ! { dg-error "present on multiple clauses" }
+ !$acc host_data use_device(/b/, /b/)
!$acc end host_data
+ ! { dg-error "neither a POINTER nor an array" "" { target *-*-* } 102 }
+ ! { dg-error "present on multiple clauses" "" { target *-*-* } 102 }
- !$acc host_data use_device(i, j, i) ! { dg-error "present on multiple clauses" }
+ !$acc host_data use_device(i, j, i)
!$acc end host_data
+ ! { dg-error "neither a POINTER nor an array" "" { target *-*-* } 107 }
+ ! { dg-error "present on multiple clauses" "" { target *-*-* } 107 }
- !$acc host_data use_device(p1) ! { dg-error "POINTER" }
+ !$acc host_data use_device(p1)
!$acc end host_data
end program test
diff --git a/gcc/testsuite/gfortran.dg/goacc/uninit-use-device-clause.f95 b/gcc/testsuite/gfortran.dg/goacc/uninit-use-device-clause.f95
index 873eea70a76..48d08a5a55d 100644
--- a/gcc/testsuite/gfortran.dg/goacc/uninit-use-device-clause.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/uninit-use-device-clause.f95
@@ -2,9 +2,9 @@
! { dg-additional-options "-Wuninitialized" }
subroutine test
- integer :: i
+ integer, pointer :: p
- !$acc host_data use_device(i) ! { dg-warning "is used uninitialized in this function" }
+ !$acc host_data use_device(p) ! { dg-warning "is used uninitialized in this function" }
!$acc end host_data
end subroutine test
diff --git a/libgomp/ChangeLog.gomp b/libgomp/ChangeLog.gomp
index eb93da5f3c1..039cffcd1e1 100644
--- a/libgomp/ChangeLog.gomp
+++ b/libgomp/ChangeLog.gomp
@@ -1,3 +1,7 @@
+2016-07-29 Chung-Lin Tang <cltang@codesourcery.com>
+
+ * testsuite/libgomp.oacc-fortran/host_data-1.f90: Adjust testcase.
+
2016-07-27 Cesar Philippidis <cesar@codesourcery.com>
* testsuite/libgomp.oacc-fortran/abort-1.f90:
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/host_data-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/host_data-1.f90
index 9bb79c38261..497b0f78bb2 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/host_data-1.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/host_data-1.f90
@@ -8,18 +8,19 @@ program test
implicit none
integer, target :: i, arr(1000)
- integer, pointer :: ip, parr(:), iph, parrh(:)
+ integer, pointer :: ip, iph
+ integer, contiguous, pointer :: parr(:), parrh(:)
- !$acc data copyin(i, arr)
- !$acc host_data use_device(i, arr)
+ ! Assign the same targets
ip => i
parr => arr
- !$acc end host_data
- !$acc end data
-
iph => i
parrh => arr
+ !$acc data copyin(i, arr)
+ !$acc host_data use_device(ip, parr)
+
+ ! Test how the pointers compare inside a host_data construct
#if ACC_MEM_SHARED
if (.not. associated(ip, iph)) call abort
if (.not. associated(parr, parrh)) call abort
@@ -28,4 +29,7 @@ program test
if (associated(parr, parrh)) call abort
#endif
+ !$acc end host_data
+ !$acc end data
+
end program test