public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Thomas Schwinge <thomas@codesourcery.com>
Cc: Cesar Philippidis <cesar@codesourcery.com>,
	       "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [openacc] acc loop updates in fortran
Date: Wed, 04 Nov 2015 17:21:00 -0000	[thread overview]
Message-ID: <20151104172136.GN478@tucnak.redhat.com> (raw)
In-Reply-To: <87ziytznx9.fsf@kepler.schwinge.homeip.net>

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

  reply	other threads:[~2015-11-04 17:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-04  3:07 Cesar Philippidis
2015-11-04 10:30 ` Jakub Jelinek
2015-11-04 17:20   ` Thomas Schwinge
2015-11-04 17:23     ` Jakub Jelinek
2015-11-04 17:15 ` Thomas Schwinge
2015-11-04 17:21   ` Jakub Jelinek [this message]
2015-11-04 17:42     ` Thomas Schwinge
2015-11-04 17:39   ` Cesar Philippidis
2015-11-04 17:51     ` Jakub Jelinek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151104172136.GN478@tucnak.redhat.com \
    --to=jakub@redhat.com \
    --cc=cesar@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=thomas@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).