public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Tobias Burnus <tobias@codesourcery.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>, fortran <fortran@gcc.gnu.org>
Subject: Re: [Patch] OpenMP: Accept argument to depobj's destroy clause
Date: Thu, 23 Nov 2023 16:32:07 +0100	[thread overview]
Message-ID: <ZV9wd6kQgS2j9Pit@tucnak> (raw)
In-Reply-To: <bb73a54a-2ba1-4fc6-b717-016d956682c2@codesourcery.com>

On Thu, Nov 23, 2023 at 04:21:50PM +0100, Tobias Burnus wrote:
> @@ -21663,7 +21666,25 @@ c_parser_omp_depobj (c_parser *parser)
>  	    clause = error_mark_node;
>  	}
>        else if (!strcmp ("destroy", p))
> -	kind = OMP_CLAUSE_DEPEND_LAST;
> +	{
> +	  matching_parens c_parens;
> +	  kind = OMP_CLAUSE_DEPEND_LAST;
> +	  if (c_parser_next_token_is (parser, CPP_OPEN_PAREN)
> +	      && c_parens.require_open (parser))
> +	    {
> +	      tree destobj = c_parser_expr_no_commas (parser, NULL).value;
> +	      if (!lvalue_p (destobj))
> +		error_at (EXPR_LOC_OR_LOC (destobj, c_loc),
> +			  "%<destrory%> expression is not lvalue expression");
> +	      else if (depobj != error_mark_node
> +		       && !operand_equal_p (destobj, depobj,
> +					    OEP_MATCH_SIDE_EFFECTS))

There is also OEP_LEXICOGRAPHIC which could be used in addition to that.
The question is if we want to consider say
#pragma depobj (a[++i]) destroy (a[++i])
as same or different (similarly a[foo ()] in both cases).
A function could at least in theory return the same value, for other
side-effects there is some wiggle room in unspecified number of times how
many the side-effects of clauses are evaluated (and for destroy we really
don't intend to evaluate them at all for the clause, just for the directive
argument).

	Jakub


  reply	other threads:[~2023-11-23 15:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-23 14:21 Tobias Burnus
2023-11-23 14:32 ` Jakub Jelinek
2023-11-23 15:21   ` Tobias Burnus
2023-11-23 15:32     ` Jakub Jelinek [this message]
2023-11-23 15:59       ` Tobias Burnus
2023-11-23 16:46         ` Jakub Jelinek
2023-11-24 12:24           ` [Patch,v3] " Tobias Burnus

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=ZV9wd6kQgS2j9Pit@tucnak \
    --to=jakub@redhat.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=tobias@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).