This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [gomp4] don't error on implicitly private induction variables in gfortran
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Cesar Philippidis <cesar at codesourcery dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Fortran List <fortran at gcc dot gnu dot org>
- Date: Fri, 27 Jan 2017 16:07:19 +0100
- Subject: Re: [gomp4] don't error on implicitly private induction variables in gfortran
- Authentication-results: sourceware.org; auth=none
- References: <ac10bd90-b1e1-c03d-1ad4-436974da1ab4@codesourcery.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Jan 27, 2017 at 07:02:45AM -0800, Cesar Philippidis wrote:
> While experimenting with some new OpenACC benchmarks, I noticed that
> gfortran errors when the user explicitly marks loop induction variables
> as private. I applied this patch to gomp-4_0-branch to resolve that problem.
>
> Cesar
> 2017-01-26 Cesar Philippidis <cesar@codesourcery.com>
>
> gcc/fortran/
> * openmp.c (gfc_resolve_oacc_blocks): Populate list of private
> variables.
>
> gcc/testsuite/
> * gfortran.dg/goacc/implicitly-private.f90: New test.
>
>
> diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
> index 61940d7..2782a8d 100644
> --- a/gcc/fortran/openmp.c
> +++ b/gcc/fortran/openmp.c
> @@ -5192,7 +5192,8 @@ gfc_resolve_oacc_blocks (gfc_code *code, gfc_namespace *ns)
> {
> fortran_omp_context ctx;
> oacc_function dims = OACC_FUNCTION_NONE;
> -
> + gfc_omp_namelist *n;
> +
> resolve_oacc_loop_blocks (code);
>
> ctx.code = code;
> @@ -5217,6 +5218,10 @@ gfc_resolve_oacc_blocks (gfc_code *code, gfc_namespace *ns)
> ctx.dims = dims;
> omp_current_ctx = &ctx;
>
> + if (code->ext.omp_clauses)
> + for (n = code->ext.omp_clauses->lists[OMP_LIST_PRIVATE]; n; n = n->next)
> + ctx.private_iterators->add (n->sym);
Do you really want to add to private_iterators even variables that aren't
iterators, just arbitrary private variable?
Jakub