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