From 9f15ed31065cf6baaae9b3e0e4c16fb9e958fbd9 Mon Sep 17 00:00:00 2001
From: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue, 18 Jun 2019 22:15:53 +0000
Subject: [PATCH] [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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@272454 138bc75d-0d04-0410-961f-82ee72b054a4
---
gcc/fortran/ChangeLog | 6 ++++++
gcc/fortran/trans-decl.c | 2 +-
gcc/testsuite/ChangeLog | 3 +++
gcc/testsuite/gfortran.dg/goacc/declare-3.f95 | 6 ++++++
4 files changed, 16 insertions(+), 1 deletion(-)
@@ -1,3 +1,9 @@
+2019-06-18 Julian Brown <julian@codesourcery.com>
+
+ PR fortran/90921
+ * trans-decl.c (finish_oacc_declare): Reset module_oacc_clauses
+ before scanning each namespace.
+
2019-06-18 Thomas Schwinge <thomas@codesourcery.com>
PR fortran/85221
@@ -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)
@@ -1,5 +1,8 @@
2019-06-18 Thomas Schwinge <thomas@codesourcery.com>
+ PR fortran/90921
+ * gfortran.dg/goacc/declare-3.f95: Update.
+
PR fortran/85221
* gfortran.dg/goacc/declare-3.f95: New file.
@@ -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 } }
--
2.20.1