On Thu, Jun 02, 2016 at 09:55:05PM +0800, Chung-Lin Tang wrote: > fortran/ > * trans-openmp.c (gfc_trans_omp_clauses): Mark OpenACC reduction > arguments as addressable when async clause exists.
Wouldn't it be better to pass either a bool openacc_async flag, or whole clauses, down to gfc_trans_omp_reduction_list and handle it there instead of walking the list after the fact? > Index: trans-openmp.c > =================================================================== > --- trans-openmp.c (revision 236845) > +++ trans-openmp.c (working copy) > @@ -1748,6 +1748,12 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp > { > 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. */ > + if (clauses->async) > + for (c = omp_clauses; c; c = OMP_CLAUSE_CHAIN (c)) > + if (DECL_P (OMP_CLAUSE_DECL (c))) > + TREE_ADDRESSABLE (OMP_CLAUSE_DECL (c)) = 1; > break; > case OMP_LIST_PRIVATE: > clause_code = OMP_CLAUSE_PRIVATE; Jakub