openmp: Handle rest of EXEC_OACC_* in oacc_code_to_statement [PR93463]
authorJakub Jelinek <jakub@redhat.com>
Wed, 29 Jan 2020 08:39:16 +0000 (09:39 +0100)
committerJakub Jelinek <jakub@redhat.com>
Wed, 29 Jan 2020 08:39:16 +0000 (09:39 +0100)
As the testcase shows, some EXEC_OACC_* codes weren't handled in
oacc_code_to_statement.  Fixed thusly.

2020-01-29  Jakub Jelinek  <jakub@redhat.com>

PR fortran/93463
* openmp.c (oacc_code_to_statement): Handle
EXEC_OACC_{ROUTINE,UPDATE,WAIT,CACHE,{ENTER,EXIT}_DATA,DECLARE}.

* gfortran.dg/goacc/pr93463.f90: New test.

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

index 0033246b9924df172c2ae3caded4e690fbba3aeb..12e5996b186c705d3ed6742ccdf6fd77f2a7d4b2 100644 (file)
@@ -1,3 +1,9 @@
+2020-01-29  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/93463
+       * openmp.c (oacc_code_to_statement): Handle
+       EXEC_OACC_{ROUTINE,UPDATE,WAIT,CACHE,{ENTER,EXIT}_DATA,DECLARE}.
+
 2020-01-28  Andrew Benson  <abensonca@gmail.com>
 
         PR fortran/93461
index 0accb185e87de4b22001e6e9a8741fb461874063..b885e86c6586d80fd012657558ed76f96ebb4070 100644 (file)
@@ -6021,6 +6021,20 @@ oacc_code_to_statement (gfc_code *code)
       return ST_OACC_LOOP;
     case EXEC_OACC_ATOMIC:
       return ST_OACC_ATOMIC;
+    case EXEC_OACC_ROUTINE:
+      return ST_OACC_ROUTINE;
+    case EXEC_OACC_UPDATE:
+      return ST_OACC_UPDATE;
+    case EXEC_OACC_WAIT:
+      return ST_OACC_WAIT;
+    case EXEC_OACC_CACHE:
+      return ST_OACC_CACHE;
+    case EXEC_OACC_ENTER_DATA:
+      return ST_OACC_ENTER_DATA;
+    case EXEC_OACC_EXIT_DATA:
+      return ST_OACC_EXIT_DATA;
+    case EXEC_OACC_DECLARE:
+      return ST_OACC_DECLARE;
     default:
       gcc_unreachable ();
     }
index a4a775d35560e33c172fc39e043e2cbcfc5d42b6..d13de9a3f848122c03e334dc3219e2e6b78e3cae 100644 (file)
@@ -1,3 +1,8 @@
+2020-01-29  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/93463
+       * gfortran.dg/goacc/pr93463.f90: New test.
+
 2020-01-29  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/93428
diff --git a/gcc/testsuite/gfortran.dg/goacc/pr93463.f90 b/gcc/testsuite/gfortran.dg/goacc/pr93463.f90
new file mode 100644 (file)
index 0000000..920892f
--- /dev/null
@@ -0,0 +1,15 @@
+! PR fortran/93463
+! { dg-do compile { target fopenmp } }
+! { dg-additional-options "-fopenmp" }
+
+program pr93463
+   integer :: i, x, y, z
+   !$omp parallel do
+   do i = 1, 4
+      !$acc enter data create(x)       ! { dg-error "ACC ENTER DATA directive cannot be specified within" }
+      !$acc exit data copyout(x)       ! { dg-error "ACC EXIT DATA directive cannot be specified within" }
+      !$acc cache(y)                   ! { dg-error "ACC CACHE directive cannot be specified within" }
+      !$acc wait(1)                    ! { dg-error "ACC WAIT directive cannot be specified within" }
+      !$acc update self(z)             ! { dg-error "ACC UPDATE directive cannot be specified within" }
+   end do
+end