aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/openmp.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/pr85701.f9023
4 files changed, 41 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 079a306..23a4065 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2018-06-05 Cesar Philippidis <cesar@codesourcery.com>
+
+ PR fortran/85701
+
+ * openmp.c (gfc_resolve_oacc_declare): Error on functions and
+ subroutine data clause arguments.
+
2018-06-04 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/85981
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index be80f8d..5c13312 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -5994,6 +5994,12 @@ gfc_resolve_oacc_declare (gfc_namespace *ns)
for (n = oc->clauses->lists[list]; n; n = n->next)
{
n->sym->mark = 0;
+ if (n->sym->attr.function || n->sym->attr.subroutine)
+ {
+ gfc_error ("Object %qs is not a variable at %L",
+ n->sym->name, &oc->loc);
+ continue;
+ }
if (n->sym->attr.flavor == FL_PARAMETER)
{
gfc_error ("PARAMETER object %qs is not allowed at %L",
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a049d14..83aef99 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-06-05 Cesar Philippidis <cesar@codesourcery.com>
+
+ PR fortran/85701
+ * gfortran.dg/goacc/pr85701.f90: New test.
+
2018-06-05 Marek Polacek <polacek@redhat.com>
PR c++/85976
diff --git a/gcc/testsuite/gfortran.dg/goacc/pr85701.f90 b/gcc/testsuite/gfortran.dg/goacc/pr85701.f90
new file mode 100644
index 0000000..9c201b8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/pr85701.f90
@@ -0,0 +1,23 @@
+! PR fortran/85701
+! { dg-do compile }
+
+subroutine s1
+ !$acc declare copy(s1) ! { dg-error "is not a variable" }
+end
+
+subroutine s2
+ !$acc declare present(s2) ! { dg-error "is not a variable" }
+end
+
+function f1 ()
+ !$acc declare copy(f1) ! { dg-error "is not a variable" }
+end
+
+function f2 ()
+ !$acc declare present(f2) ! { dg-error "is not a variable" }
+end
+
+program p
+ !$acc declare copy(p) ! { dg-error "is not a variable" }
+end
+