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

            Bug ID: 118965
           Summary: [OpenMP] require at least one target/targetsync with
                    append_args' interop and 'interop's init clause
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, diagnostic, openmp
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

GCC accepts:
  omp interop init(obj)  init(prefer_type("...") : obj2)
and
  omp declare variant(...) ... append_args(interop(prefer_type("...")))

namely: 'init(...)' and 'append_args(interop(...))' without TARGET or
TARGETSYNC.

EXPECTED:

* Reject this - by requiring at least one of target/targetsync
  (and no duplicates, but that's already checked for)

* This also implies that having modifiers to init are always required
  and not optional (with 'interop'; in 6.0, 'init' is also clause on
  'depend', but there the depinfo-modifier is required)

* * *

In principle, GCC implementation would be fine: It permits to obtain some data;
for instance, whether a certain type of foreign runtime is available at all.
Still, as it is not valid, we should reject it. Available data by flag:

OpenMP 6.0's "5.6 init Clause" has:

* For any interop-type, the properties type, type_name, vendor, vendor_name and
device_num will be available
* The targetsync interop-type will additionally provide the targetsync property
* The target interop-type will additionally provide the following properties …
device … device_context … platform

* * *

OpenMP 5.1 has
---------------------------
  init([interop-modifier, ]interop-type[[, interop-type] ... ]:interop-var)

interop-modifier = prefer_type
interop-type = target | targetsync
• Each interop-type may be specified on an action-clause at most once
---------------------------

OpenMP 5.2 has in "14.1.2 init Clause":
---------------------------
interop-preference | prefer_type        | complex, unique
interop-type       | target, targetsync | repeatable, required

• Each interop-type may be specified at most once.
---------------------------

OpenMP 6.0 has:
---------------------------
interop-preference | prefer_type        | complex, unique
interop-type       | target, targetsync | repeatable

• If the init clause appears on an interop construct, the interop-type modifier
has the required property and each interop-type keyword has the unique
property. Otherwise, the interop-type modifier must not be present.
---------------------------

Reply via email to