re PR fortran/85701 ([openacc] ICE in mark_scope_block_unused, at tree-ssa-live.c...
authorCesar Philippidis <cesar@codesourcery.com>
Tue, 5 Jun 2018 13:58:50 +0000 (06:58 -0700)
committerCesar Philippidis <cesar@gcc.gnu.org>
Tue, 5 Jun 2018 13:58:50 +0000 (06:58 -0700)
PR fortran/85701

gcc/fortran/
* openmp.c (gfc_resolve_oacc_declare): Error on functions and
subroutine data clause arguments.

gcc/testsuite/
* gfortran.dg/goacc/pr85701.f90: New test.

From-SVN: r261202

gcc/fortran/ChangeLog
gcc/fortran/openmp.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/goacc/pr85701.f90 [new file with mode: 0644]

index 079a306c451a3b90df07859199e54b96bf4b4d87..23a406505837a16d6e09b7e497cc3957bf3a2b1d 100644 (file)
@@ -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
index be80f8dea24ffc56c2ce38cbd3ad048270f44ae3..5c13312585ac5b1681ac7f1951abe6b063483c40 100644 (file)
@@ -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",
index a049d14e886a47752a93663eb3e0dcf232d4cb1f..83aef9947485d69a5df825ee6396a6cfc4027d79 100644 (file)
@@ -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 (file)
index 0000000..9c201b8
--- /dev/null
@@ -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
+