public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [gomp4] teach fortran to reject the device clause in acc routines
@ 2015-11-19 16:44 Cesar Philippidis
  0 siblings, 0 replies; only message in thread
From: Cesar Philippidis @ 2015-11-19 16:44 UTC (permalink / raw)
  To: gcc-patches, Fortran List

[-- Attachment #1: Type: text/plain, Size: 418 bytes --]

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


[-- Attachment #2: gfc-routines-remove-device.diff --]
[-- Type: text/x-patch, Size: 1488 bytes --]

2015-11-19  Cesar Philippidis  <cesar@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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-11-19 16:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-19 16:44 [gomp4] teach fortran to reject the device clause in acc routines Cesar Philippidis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).