public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Hafiz Abid Qadeer <abidh@codesourcery.com>,
	tobias@codesourcery.com, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] [gfortran] Add support for allocate clause (OpenMP 5.0).
Date: Tue, 2 Nov 2021 18:54:17 +0100	[thread overview]
Message-ID: <20211102175417.GG304296@tucnak> (raw)
In-Reply-To: <20211102162714.GF304296@tucnak>

On Tue, Nov 02, 2021 at 05:27:14PM +0100, Jakub Jelinek via Gcc-patches wrote:
> I'm not sure this is what the standard says, certainly C/C++ FE do this
> quite differently for combined/composite constructs.
> In particular, we first split the clauses to the individual leaf constructs
> in c_omp_split_clauses, which for allocate clause is even more complicated
> because as clarified in 5.2:
> "The effect of the allocate clause is as if it is applied to all leaf constructs that permit the clause
> and to which a data-sharing attribute clause that may create a private copy of the same list item is
> applied."
> so there is the has_dup_allocate stuff, we first duplicate it to all leaf
> constructs that allow the allocate clause and set has_dup_allocate if it is
> put on more than one construct, and then if has_dup_allocate is set, do
> more detailed processing.  And finally then {,c_}finish_omp_clauses
> diagnoses what you are trying above, but only on each leaf construct
> separately.
> 
> Now, Fortran is performing the splitting of clauses only much later in
> trans-openmp.c, I wonder if it doesn't have other issues on
> combined/composite constructs if it performs other checks only on the
> clauses on the whole combined/composite construct and not just each leaf
> separately.  I'd say we should move that diagnostics and perhaps other
> similar later on into a separate routine that is invoked only after the
> clauses are split or for non-combined/composite construct clauses.

Testcases unrelated to allocate clause that have same problematic behavior:

void
foo (int x)
{
  #pragma omp parallel for simd shared (x) private (x)
  for (int i = 0; i < 32; i++)
    ;
}

is correctly accepted, as per
Clauses on Combined and Composite Constructs
shared clause goes to parallel construct, private goes to innermost
leaf aka simd, so there is no leaf construct with multiple data sharing
clauses for x.

But:

subroutine foo (x)
  integer :: x, i
  !$omp parallel do simd shared (x) private (x)
  do i = 1, 32
  end do
end subroutine

is incorrectly rejected with:
    3 |   !$omp parallel do simd shared (x) private (x)
      |                                 1
Error: Symbol ‘x’ present on multiple clauses at (1)

	Jakub


  reply	other threads:[~2021-11-02 17:54 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-22 13:05 Hafiz Abid Qadeer
2021-10-22 13:28 ` Tobias Burnus
2021-11-02 16:27 ` Jakub Jelinek
2021-11-02 17:54   ` Jakub Jelinek [this message]
2021-11-18 19:30   ` Hafiz Abid Qadeer
2021-12-20 20:06     ` Jakub Jelinek
2022-01-11 22:31       ` Hafiz Abid Qadeer
2022-01-13 12:50         ` Jakub Jelinek
2022-01-14  9:10         ` Thomas Schwinge
2022-01-14 11:45           ` Tobias Burnus
2022-01-14 11:55             ` Jakub Jelinek
2022-01-14 12:20               ` Tobias Burnus
2022-01-17 14:01                 ` Hafiz Abid Qadeer
2022-01-21 17:15         ` Thomas Schwinge
2022-01-21 17:43           ` Tobias Burnus
2022-01-24  8:45             ` Tobias Burnus
2022-01-24 12:54               ` Hafiz Abid Qadeer
2022-01-25  9:19                 ` Thomas Schwinge
2022-01-25 10:32                   ` Tobias Burnus
2022-01-31 19:13                     ` Hafiz Abid Qadeer
2022-02-04  9:46                       ` Thomas Schwinge
2022-02-04 11:25                         ` Hafiz Abid Qadeer
2022-02-05 19:09                           ` Hafiz Abid Qadeer
2022-02-16 10:29                             ` Hafiz Abid Qadeer
2022-02-04  9:37               ` Thomas Schwinge
2022-02-04 13:57                 ` [committed] libgomp.fortran/allocate-1.f90: Minor cleanup (was: Re: [PATCH] [gfortran] Add support for allocate clause (OpenMP 5.0).) Tobias Burnus
2022-02-04 15:33                   ` Thomas Schwinge
2022-02-04 16:34                     ` 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=20211102175417.GG304296@tucnak \
    --to=jakub@redhat.com \
    --cc=abidh@codesourcery.com \
    --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).