public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/113904] New: [OpenMP][5.0][5.1] Dynamic context selector 'user={condition(expr)}' not handled
Date: Tue, 13 Feb 2024 11:26:44 +0000	[thread overview]
Message-ID: <bug-113904-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 113904
           Summary: [OpenMP][5.0][5.1] Dynamic context selector
                    'user={condition(expr)}' not handled
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, openmp, rejects-valid, wrong-code
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: parras at gcc dot gnu.org, sandra at gcc dot gnu.org
  Target Milestone: ---

There are two related problems, leading currently to either
  wrong-code (Fortran - alias accepts-invalid OpenMP 5.0)
  or rejects-valid OpenMP 5.1 (C/C++).

* Fortran accepts non constant values - but the ME does not handle them.
  → OpenMP 5.1 feature supported for parsing but not in the ME
  → wrong-code

* C/C++ rejects non-const values
  → Rejecting valid 5.1 code



gfortran happily accepts non constant values - while gcc/g++ reject them

test.c:22:58: error: the value of 'foo_use_var2' is not usable in a constant
expression
   22 | #pragma omp declare variant (var2)
match(user={condition(foo_use_var2)})


While OpenMP 5.0 only permits
   The user selector set defines the condition selector that provides
   additional user-defined conditions.

   C: The condition(boolean-expr) selector defines a constant expression
   that must evaluate to true for the selector to be true.

   C++: The condition(boolean-expr) selector defines a constexpr
   expression that must evaluate to true for the selector to be true.

   Fortran: The condition(logical-expr) selector defines a constant
   expression that must evaluate to true for the selector to be true.


Since OpenMP 5.1:
  The condition selector contains a single trait-property-expression
  that must evaluate to true for the selector to be true.
  Any non-constant expression that is evaluated to determine the
  suitability of a variant is evaluated according to the data state
  trait in the dynamic trait set of the OpenMP context.
  The user selector set is dynamic if the condition selector is present
  and the expression in the condition selector is not a constant
  expression; otherwise, it is static.

             reply	other threads:[~2024-02-13 11:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13 11:26 burnus at gcc dot gnu.org [this message]
2024-02-13 17:32 ` [Bug middle-end/113904] " burnus at gcc dot gnu.org
2024-02-13 19:56 ` cvs-commit at gcc dot gnu.org
2024-02-13 20:29 ` burnus at gcc dot gnu.org
2024-02-13 21:06 ` sandra at gcc dot gnu.org
2024-04-11  4:51 ` sandra at gcc dot gnu.org
2024-04-12  3:00 ` sandra at gcc dot gnu.org
2024-05-14  0:44 ` sandra 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-113904-4@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).