public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/71065] Missing diagnostic for statements between OpenMP 'target' and 'teams'
       [not found] <bug-71065-4@http.gcc.gnu.org/bugzilla/>
@ 2021-10-29 13:30 ` burnus at gcc dot gnu.org
  2021-10-29 13:42 ` burnus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-10-29 13:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71065

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
>From IRC: "because many statements could be added by the compiler in between
for whatever reasons (e.g. statements needed for the clauses of the teams
construct)
"so the checking would need to be done very early on the FE side before we
start handling the clauses
"bet easier done on the Fortran FE side..."

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/71065] Missing diagnostic for statements between OpenMP 'target' and 'teams'
       [not found] <bug-71065-4@http.gcc.gnu.org/bugzilla/>
  2021-10-29 13:30 ` [Bug middle-end/71065] Missing diagnostic for statements between OpenMP 'target' and 'teams' burnus at gcc dot gnu.org
@ 2021-10-29 13:42 ` burnus at gcc dot gnu.org
  2023-07-24 20:58 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-10-29 13:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71065

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
>From IRC: "testcases where nothing should be diagnosed would include e.g.
lambdas in expressions inside of teams clauses and similar nastiness"

Simple examples:

  #pragma omp target map(tofrom: b[0:100]) 
  {
    int n;
    #pragma omp teams
    #pragma omp distribute simd aligned(b: 8*sizeof(int))
    for(int k=0; k<N; k++)
      b[k] = k;
  }

for which clang currently has:
t-distribute-simd-clauses/test.c:18:3: error: target construct with nested
teams region contains statements outside of the teams construct
  #pragma omp target map(tofrom: b[0:100]) 
  ^
t-distribute-simd-clauses/test.c:21:5: note: nested teams construct here
    #pragma omp teams
    ^
t-distribute-simd-clauses/test.c:20:5: note: statement outside teams construct
here
    int n;
    ^

Or "int n" moved just before the '}'.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/71065] Missing diagnostic for statements between OpenMP 'target' and 'teams'
       [not found] <bug-71065-4@http.gcc.gnu.org/bugzilla/>
  2021-10-29 13:30 ` [Bug middle-end/71065] Missing diagnostic for statements between OpenMP 'target' and 'teams' burnus at gcc dot gnu.org
  2021-10-29 13:42 ` burnus at gcc dot gnu.org
@ 2023-07-24 20:58 ` cvs-commit at gcc dot gnu.org
  2023-07-25 13:45 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-24 20:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71065

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:

https://gcc.gnu.org/g:2e31fe431b08b0302e1fa8a1c18ee51adafd41df

commit r14-2754-g2e31fe431b08b0302e1fa8a1c18ee51adafd41df
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Mon Jul 24 22:57:07 2023 +0200

    OpenMP/Fortran: Reject not strictly nested target -> teams [PR110725,
PR71065]

    OpenMP requires: "If a teams region is nested inside a target region, the
    corresponding target construct must not contain any statements,
declarations
    or directives outside of the corresponding teams construct."

    This commit checks now for this restriction.

            PR fortran/110725
            PR middle-end/71065

    gcc/fortran/ChangeLog:

            * gfortran.h (gfc_omp_clauses): Add contains_teams_construct.
            * openmp.cc (resolve_omp_target): New; check for teams nesting.
            (gfc_resolve_omp_directive): Call it.
            * parse.cc (decode_omp_directive): Set contains_teams_construct
            on enclosing ST_OMP_TARGET.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/gomp/pr99226.f90: Update dg-error.
            * gfortran.dg/gomp/teams-5.f90: New test.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/71065] Missing diagnostic for statements between OpenMP 'target' and 'teams'
       [not found] <bug-71065-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2023-07-24 20:58 ` cvs-commit at gcc dot gnu.org
@ 2023-07-25 13:45 ` cvs-commit at gcc dot gnu.org
  2023-07-25 13:48 ` burnus at gcc dot gnu.org
  2023-07-27 16:17 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-25 13:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71065

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:

https://gcc.gnu.org/g:09dda270380fe13e7b4722305cb1122df1f779a0

commit r14-2761-g09dda270380fe13e7b4722305cb1122df1f779a0
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Tue Jul 25 15:43:58 2023 +0200

    OpenMP/Fortran: Reject declarations between target + teams

    While commit r14-2754-g2e31fe431b08b0302e1fa8a1c18ee51adafd41df
    detected executable statements, declarations do not show up as
    executable statements.  Hence, we now check whether the first
    statement after TARGET is TEAMS - such that we can detect data
    statements like type or variable declarations.  Fortran semantics
    ensures that only executable directives/statemens can come after
    '!$omp end teams' such that those can be detected with the
    previous check.

    Note that statements returning ST_NONE such as 'omp nothing' or
    'omp error at(compilation)' will still slip through.

            PR fortran/110725
            PR middle-end/71065

    gcc/fortran/ChangeLog:

            * gfortran.h (gfc_omp_clauses): Add target_first_st_is_teams.
            * parse.cc (parse_omp_structured_block): Set it if the first
            statement in the structured block of a TARGET is TEAMS or
            a combined/composite starting with TEAMS.
            * openmp.cc (resolve_omp_target): Also show an error for
            contains_teams_construct without target_first_st_is_teams.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/gomp/teams-6.f90: New test.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/71065] Missing diagnostic for statements between OpenMP 'target' and 'teams'
       [not found] <bug-71065-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2023-07-25 13:45 ` cvs-commit at gcc dot gnu.org
@ 2023-07-25 13:48 ` burnus at gcc dot gnu.org
  2023-07-27 16:17 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2023-07-25 13:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71065

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Fortran
=======
Should be complete with:

* the commit r14-2754-g2e31fe431b08b0 in comment 5
  (checking for tailing executable statements + tailing)

* A follow-up testcase fix in commit r14-2759-g50656980497d77

* the commit r14-2761-g09dda270380fe1 in comment 6
  (also rejecting declarations before 'teams').

C/C++ - unimplemented
=====
For C/C++, something similar to Fortran is needed. Including rejecting bare ';'
statements while properly handling lambdas, templates etc.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/71065] Missing diagnostic for statements between OpenMP 'target' and 'teams'
       [not found] <bug-71065-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2023-07-25 13:48 ` burnus at gcc dot gnu.org
@ 2023-07-27 16:17 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-27 16:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71065

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:

https://gcc.gnu.org/g:081e25d3cfd86c4094999ded0bbe99b91762013c

commit r14-2826-g081e25d3cfd86c4094999ded0bbe99b91762013c
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Thu Jul 27 18:14:11 2023 +0200

    OpenMP/Fortran: Extend reject code between target + teams [PR71065,
PR110725]

    The previous version failed to diagnose when the 'teams' was nested
    more deeply inside the target region, e.g. inside a DO or some
    block or structured block.

                PR fortran/110725
                PR middle-end/71065

    gcc/fortran/ChangeLog:

            * openmp.cc (resolve_omp_target): Minor cleanup.
            * parse.cc (decode_omp_directive): Find TARGET statement
            also higher in the stack.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/gomp/teams-6.f90: Extend.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-07-27 16:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-71065-4@http.gcc.gnu.org/bugzilla/>
2021-10-29 13:30 ` [Bug middle-end/71065] Missing diagnostic for statements between OpenMP 'target' and 'teams' burnus at gcc dot gnu.org
2021-10-29 13:42 ` burnus at gcc dot gnu.org
2023-07-24 20:58 ` cvs-commit at gcc dot gnu.org
2023-07-25 13:45 ` cvs-commit at gcc dot gnu.org
2023-07-25 13:48 ` burnus at gcc dot gnu.org
2023-07-27 16:17 ` cvs-commit at gcc dot gnu.org

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).