While porting the fortran acc routine changes from gomp4 to trunk, I
noticed that device was listed in the acc routine clause mask. That is
incorrect; it should be device_type not device. I fixed that problem in
the trunk patch submission. Here's the corresponding fix and test case
that I applied to gomp4.

As time permits, I'll add more test cases with invalid clause
combination for all of the constructs.

Cesar

2015-11-19  Cesar Philippidis  <ce...@codesourcery.com>

	gcc/fortran/
	* openmp.c (OACC_ROUTINE_CLAUSES): Remove OMP_CLAUSE_OACC_DEVICE
	from the clause mask.

	gcc/testsuite/
	* gfortran.dg/goacc/routine-6.f90: Ensure that the device clause is
	invalid with acc routines.

diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index c17d071..e8e8071 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -1312,8 +1312,7 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, uint64_t mask,
   (OMP_CLAUSE_ASYNC)
 #define OACC_ROUTINE_CLAUSES \
   (OMP_CLAUSE_GANG | OMP_CLAUSE_WORKER | OMP_CLAUSE_VECTOR | OMP_CLAUSE_SEQ \
-   | OMP_CLAUSE_BIND | OMP_CLAUSE_OACC_DEVICE | OMP_CLAUSE_NOHOST           \
-   | OMP_CLAUSE_DEVICE_TYPE)
+   | OMP_CLAUSE_BIND | OMP_CLAUSE_NOHOST | OMP_CLAUSE_DEVICE_TYPE)
 
 #define OACC_LOOP_CLAUSE_DEVICE_TYPE_MASK \
   (OMP_CLAUSE_COLLAPSE | OMP_CLAUSE_GANG | OMP_CLAUSE_WORKER		    \
diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-6.f90 b/gcc/testsuite/gfortran.dg/goacc/routine-6.f90
index 1efe7ab..10951ee 100644
--- a/gcc/testsuite/gfortran.dg/goacc/routine-6.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/routine-6.f90
@@ -77,3 +77,13 @@ subroutine subr4 (x)
      x = x * x - 1
   end if
 end subroutine subr4
+
+subroutine subr10 (x)
+  !$acc routine (subr10) device ! { dg-error "Unclassifiable OpenACC directive" }
+  integer, intent(inout) :: x
+  if (x < 1) then
+     x = 1
+  else
+     x = x * x - 1
+  end if
+end subroutine subr10

Reply via email to