From aa1b56967d85bfc80d71341395f862ec2b30ca36 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 29 Jan 2020 09:39:16 +0100 Subject: [PATCH] openmp: Handle rest of EXEC_OACC_* in oacc_code_to_statement [PR93463] As the testcase shows, some EXEC_OACC_* codes weren't handled in oacc_code_to_statement. Fixed thusly. 2020-01-29 Jakub Jelinek 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 | 6 ++++++ gcc/fortran/openmp.c | 14 ++++++++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/goacc/pr93463.f90 | 15 +++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/goacc/pr93463.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 0033246b992..12e5996b186 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2020-01-29 Jakub Jelinek + + 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 PR fortran/93461 diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 0accb185e87..b885e86c658 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -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 (); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a4a775d3556..d13de9a3f84 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-01-29 Jakub Jelinek + + PR fortran/93463 + * gfortran.dg/goacc/pr93463.f90: New test. + 2020-01-29 Richard Biener 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 index 00000000000..920892fdcda --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/pr93463.f90 @@ -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 -- 2.30.2