public inbox for gcc-patches@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>,
	"Vollweiler, Marcel" <marcel@codesourcery.com>
Subject: Re: [Patch] Fortran/OpenMP: Fix depend-clause handling
Date: Tue, 15 Feb 2022 11:56:51 +0100	[thread overview]
Message-ID: <20220215105651.GO2646553@tucnak> (raw)
In-Reply-To: <5c942a0f-cc45-1919-af0b-57aa0fff8733@codesourcery.com>

On Tue, Feb 15, 2022 at 11:26:12AM +0100, Tobias Burnus wrote:
> As found by Marcel, the 'depend' clause was differently handled in
> 'omp depobj(...) depend(...)' and in 'omp task depend(...)'.
> 
> The problem was that for a scalar pointer, depobj depended
> on the pointer address - while task depended on the pointer-target address.
> 
> If one now combines depobj and direct var dependency, the dependency
> is on different addresses, such that the dependency is not honored.
> Marcel's example is testsuite/libgomp.fortran/depend-4.f90.
> (Thanks for the report!)
> 
> 
> I think in the real world, the problem is not that big as most
> code either uses depobj or a variable and does not mix them. Likewise,
> using the address of a temporary variable (cf. below) will also usually
> work in terms of dependency.
> 
> 
> The attached patch does:
> - depend clause (as used by task etc):
>   For scalar allocatable/pointer, add another dereference
> 
> - For depobj (which handles the depend clause by itself)
>   - Fix array(element) handling by coping the depend-clause.
>     Before the result was 'D.123 = var; depobj = &D.123;'
>     which is really not intended.
>   - Several issues related to optional and allocatable/pointer.
> 
> OK for mainline? Does backporting to GCC 11 make sense?

Ok.  Dunno about backporting, perhaps later.

	Jakub


  reply	other threads:[~2022-02-15 10:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-15 10:26 Tobias Burnus
2022-02-15 10:56 ` Jakub Jelinek [this message]
2022-02-15 17:01   ` [Patch] Fortran/OpenMP: Fix depend-clause handling for c_ptr (was: [Patch] Fortran/OpenMP: Fix depend-clause handling) Tobias Burnus
2022-02-15 17:36     ` Jakub Jelinek
2022-02-15 16:38 ` [Patch] Fortran/OpenMP: Fix depend-clause handling Thomas Schwinge

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