diff options
author | Chung-Lin Tang <cltang@codesourcery.com> | 2016-06-03 14:25:12 +0000 |
---|---|---|
committer | Chung-Lin Tang <cltang@gcc.gnu.org> | 2016-06-03 14:25:12 +0000 |
commit | b605f6639c14383eb274e90c4fa6f995af514fbc (patch) | |
tree | 23dd423fd8de79a39d2c78c414903727101e5b86 /gcc/fortran/trans-openmp.c | |
parent | 36b85e432865a312aa8edc8978e38266e8a0f14c (diff) | |
download | gcc-b605f6639c14383eb274e90c4fa6f995af514fbc.zip gcc-b605f6639c14383eb274e90c4fa6f995af514fbc.tar.gz gcc-b605f6639c14383eb274e90c4fa6f995af514fbc.tar.bz2 |
c-typeck.c (c_finish_omp_clauses): Mark OpenACC reduction arguments as addressable when async clause exists.
2016-06-03 Chung-Lin Tang <cltang@codesourcery.com>
c/
* c-typeck.c (c_finish_omp_clauses): Mark OpenACC reduction
arguments as addressable when async clause exists.
cp/
* semantics.c (finish_omp_clauses): Mark OpenACC reduction
arguments as addressable when async clause exists.
fortran/
* trans-openmp.c (gfc_trans_omp_reduction_list): Add mark_addressable
bool parameter, set reduction clause DECLs as addressable when true.
(gfc_trans_omp_clauses): Pass clauses->async to
gfc_trans_omp_reduction_list, add comment describing OpenACC situation.
libgomp/
* testsuite/libgomp.oacc-fortran/reduction-8.f90: New testcase.
* testsuite/libgomp.oacc-c-c++-common/reduction-8.c: New testcase.
From-SVN: r237070
Diffstat (limited to 'gcc/fortran/trans-openmp.c')
-rw-r--r-- | gcc/fortran/trans-openmp.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index d3276f9..ab07fe4 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -1646,7 +1646,7 @@ gfc_trans_omp_array_reduction_or_udr (tree c, gfc_omp_namelist *n, locus where) static tree gfc_trans_omp_reduction_list (gfc_omp_namelist *namelist, tree list, - locus where) + locus where, bool mark_addressable) { for (; namelist != NULL; namelist = namelist->next) if (namelist->sym->attr.referenced) @@ -1657,6 +1657,8 @@ gfc_trans_omp_reduction_list (gfc_omp_namelist *namelist, tree list, tree node = build_omp_clause (where.lb->location, OMP_CLAUSE_REDUCTION); OMP_CLAUSE_DECL (node) = t; + if (mark_addressable) + TREE_ADDRESSABLE (t) = 1; switch (namelist->u.reduction_op) { case OMP_REDUCTION_PLUS: @@ -1747,7 +1749,10 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses, switch (list) { case OMP_LIST_REDUCTION: - omp_clauses = gfc_trans_omp_reduction_list (n, omp_clauses, where); + /* An OpenACC async clause indicates the need to set reduction + arguments addressable, to allow asynchronous copy-out. */ + omp_clauses = gfc_trans_omp_reduction_list (n, omp_clauses, where, + clauses->async); break; case OMP_LIST_PRIVATE: clause_code = OMP_CLAUSE_PRIVATE; |