This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [openacc] acc loop updates in fortran
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Thomas Schwinge <thomas at codesourcery dot com>
- Cc: Cesar Philippidis <cesar at codesourcery dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 4 Nov 2015 18:21:36 +0100
- Subject: Re: [openacc] acc loop updates in fortran
- Authentication-results: sourceware.org; auth=none
- References: <5639764A dot 2000209 at codesourcery dot com> <87ziytznx9 dot fsf at kepler dot schwinge dot homeip dot net>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Nov 04, 2015 at 06:15:14PM +0100, Thomas Schwinge wrote:
> > --- a/gcc/fortran/openmp.c
> > +++ b/gcc/fortran/openmp.c
>
> > @@ -3028,6 +3015,22 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
> > n->sym->mark = 1;
> > }
> >
> > + /* OpenACC reductions. */
> > + if (openacc)
> > + {
> > + for (n = omp_clauses->lists[OMP_LIST_REDUCTION]; n; n = n->next)
> > + n->sym->mark = 0;
>
> Maybe I'm just confugsed, but if setting all these to zero here...
>
> > +
> > + for (n = omp_clauses->lists[OMP_LIST_REDUCTION]; n; n = n->next)
> > + {
> > + if (n->sym->mark)
> > + gfc_error ("Symbol %qs present on multiple clauses at %L",
> > + n->sym->name, &n->where);
> > + else
> > + n->sym->mark = 1;
>
> ... won't this just always run into the "else" branch?
The point is to check if some symbol isn't present multiple times in
reduction clause(s). So the first loop clears the flag as it could have
arbitrary values, and the second loop will diagnose an error if n->sym
is present multiple times in the list. reduction(+: a, b, a) and the like.
In C/C++ FE we use bitmaps for this, in Fortran FE we have mark
field for those purposes.
Jakub