Hi!

As the testcase shows, some EXEC_OACC_* codes weren't handled in
oacc_code_to_statement.  Fixed thusly.

Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk.

2020-01-29  Jakub Jelinek  <ja...@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/openmp.c.jj     2020-01-22 09:50:04.377853265 +0100
+++ gcc/fortran/openmp.c        2020-01-28 11:39:21.675952697 +0100
@@ -6003,6 +6003,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 ();
     }
--- gcc/testsuite/gfortran.dg/goacc/pr93463.f90.jj      2020-01-28 
11:51:51.129758054 +0100
+++ gcc/testsuite/gfortran.dg/goacc/pr93463.f90 2020-01-28 11:51:38.064952963 
+0100
@@ -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

        Jakub

Reply via email to