From 8ced98c6431c67b4f11b3eb4997b955b97472dc4 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Thu, 21 Mar 2019 20:54:51 +0100 Subject: [PATCH] [PR72741] The name in a Fortran OpenACC 'routine' directive refers to the containing subroutine or function gcc/fortran/ PR fortran/72741 * openmp.c (gfc_match_oacc_routine): Clarify. gcc/testsuite/ PR fortran/72741 * gfortran.dg/goacc/routine-module-mod-1.f90: Update. From-SVN: r269856 --- gcc/fortran/ChangeLog | 3 +++ gcc/fortran/openmp.c | 3 +++ gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90 | 4 ++-- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 2afab3920bd..111e3a266e9 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,8 @@ 2019-03-21 Thomas Schwinge + PR fortran/72741 + * openmp.c (gfc_match_oacc_routine): Clarify. + PR fortran/72741 * module.c (verify_OACC_ROUTINE_LOP_NONE): New function. (enum ab_attribute): Add AB_OACC_ROUTINE_LOP_GANG, diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 7a06eb58f5c..1b1a0b4108f 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -2314,6 +2314,9 @@ gfc_match_oacc_routine (void) if (st) { sym = st->n.sym; + /* If the name in a 'routine' directive refers to the containing + subroutine or function, then make sure that we'll later handle + this accordingly. */ if (gfc_current_ns->proc_name != NULL && strcmp (sym->name, gfc_current_ns->proc_name->name) == 0) sym = NULL; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8afdf3e980e..0c94f6bcacf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2019-03-21 Thomas Schwinge + PR fortran/72741 + * gfortran.dg/goacc/routine-module-mod-1.f90: Update. + PR fortran/72741 * gfortran.dg/goacc/routine-module-1.f90: New file. * gfortran.dg/goacc/routine-module-2.f90: Likewise. diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90 b/gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90 index 3855b8c8859..23c673fe3bd 100644 --- a/gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/routine-module-mod-1.f90 @@ -18,7 +18,7 @@ contains subroutine s_2 implicit none - !$acc routine seq + !$acc routine (s_2) seq integer :: i @@ -41,7 +41,7 @@ contains subroutine w_1 implicit none - !$acc routine worker + !$acc routine (w_1) worker integer :: i -- 2.30.2