public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/99226] [11 Regression] ICE in expand_expr_real_1, at expr.c:10279
Date: Wed, 24 Feb 2021 10:46:29 +0000	[thread overview]
Message-ID: <bug-99226-4-fkIBk15wxV@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99226-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #2)
> (In reply to Jakub Jelinek from comment #1)
> > This is invalid and should have been rejected, when teams is nested in
> > target, it must be the only thing nested in it, you can't have two teams
> > directives nested in one target construct.
> 
> How is this enforceable at compile time for '!$omp target; call f(); call
> g()" and then in f() and g() the teams?

That will just fail or misbehave at runtime.
The spec says that
"A teams region can only be strictly nested within the implicit parallel region
or a target region. If a teams construct is nested within a target construct,
that target construct must contain no statements, declarations or directives
outside of the teams construct."
The compiler considers teams not strictly nested inside of target as "host
teams" which is lowered and expanded differently, and teams strictly nested
inside of target as "target teams".  And the construct nesting diagnostics
then will warn if the "host teams" is nested in some other construct that it is
not allowed to be nested in, but sure, this works only for lexical nesting.

I think clang diagnoses the #c2 testcase, we don't, I think the reason was
that it wasn't as clear what exactly is and is not allowed.  E.g.
#pragma omp target
{{{{{{
#pragma omp teams
;
}}}}}}
should be allowed and some statements outside of the teams but in target might
appear artificially during the parsing of e.g. teams clauses or during their
gimplification etc.

So, either we diagnose it early in the FEs somehow, or we add some less strict
late diagnostics, e.g. allow code outside of the teams in target but require
that that code doesn't contain any OpenMP directives (or just constructs?).
I guess the latter would be far easier and could be done in
check_omp_nesting_restrictions.

  parent reply	other threads:[~2021-02-24 10:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23 18:30 [Bug fortran/99226] New: " gscfq@t-online.de
2021-02-23 18:48 ` [Bug fortran/99226] " jakub at gcc dot gnu.org
2021-02-24  8:20 ` rguenth at gcc dot gnu.org
2021-02-24 10:27 ` burnus at gcc dot gnu.org
2021-02-24 10:46 ` jakub at gcc dot gnu.org [this message]
2021-02-24 14:13 ` jakub at gcc dot gnu.org
2021-02-24 15:18 ` burnus at gcc dot gnu.org
2021-02-24 19:16 ` cvs-commit at gcc dot gnu.org
2021-02-25  8:18 ` jakub at gcc dot gnu.org

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=bug-99226-4-fkIBk15wxV@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).