From: Julian Brown Date: Tue, 18 Jun 2019 22:15:53 +0000 (+0200) Subject: [PR90921] Fortran OpenACC 'declare' directive's module handling causes duplicate... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8701b671ee19eaf54c4fc67d27ed0a2b57467f94;p=gcc.git [PR90921] Fortran OpenACC 'declare' directive's module handling causes duplicate data clauses gcc/fortran/ PR fortran/90921 * trans-decl.c (finish_oacc_declare): Reset module_oacc_clauses before scanning each namespace. gcc/testsuite/ PR fortran/90921 * gfortran.dg/goacc/declare-3.f95: Update. From-SVN: r272454 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 6fd97b61ce0..32d961ade96 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2019-06-18 Julian Brown + + PR fortran/90921 + * trans-decl.c (finish_oacc_declare): Reset module_oacc_clauses + before scanning each namespace. + 2019-06-18 Thomas Schwinge PR fortran/85221 diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index f504c279c31..64ce4bba23d 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -6491,6 +6491,7 @@ finish_oacc_declare (gfc_namespace *ns, gfc_symbol *sym, bool block) gfc_omp_clauses *omp_clauses = NULL; gfc_omp_namelist *n, *p; + module_oacc_clauses = NULL; gfc_traverse_ns (ns, find_module_oacc_declare_clauses); if (module_oacc_clauses && sym->attr.flavor == FL_PROGRAM) @@ -6502,7 +6503,6 @@ finish_oacc_declare (gfc_namespace *ns, gfc_symbol *sym, bool block) new_oc->clauses = module_oacc_clauses; ns->oacc_declare = new_oc; - module_oacc_clauses = NULL; } if (!ns->oacc_declare) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 552ccc6fbd6..6ff197c8e4d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2019-06-18 Thomas Schwinge + PR fortran/90921 + * gfortran.dg/goacc/declare-3.f95: Update. + PR fortran/85221 * gfortran.dg/goacc/declare-3.f95: New file. diff --git a/gcc/testsuite/gfortran.dg/goacc/declare-3.f95 b/gcc/testsuite/gfortran.dg/goacc/declare-3.f95 index ec5d4c5a062..80d9903a9dc 100644 --- a/gcc/testsuite/gfortran.dg/goacc/declare-3.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/declare-3.f95 @@ -1,5 +1,7 @@ ! Test valid usage of the OpenACC 'declare' directive. +! { dg-additional-options "-fdump-tree-original" } + module mod_a implicit none integer :: a @@ -44,4 +46,8 @@ program test use mod_c use mod_d use mod_e + + ! { dg-final { scan-tree-dump {(?n)#pragma acc data map\(force_alloc:d\) map\(force_deviceptr:c\) map\(force_to:b\) map\(force_alloc:a\)$} original } } end program test + +! { dg-final { scan-tree-dump-times {#pragma acc data} 1 original } }