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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This is invalid OpenMP.
As you are mentioning A in the target body, but not in its clauses, and as it
is not a scalar (new In OpenMP 4.5), it is implicitly map(tofrom:A).
And, as you mapped just a portion of the array earlier, and trying this
implicit
map of the whole array which also overlaps the explicit p[7:20] array section,
you are violating several restrictions, e.g. OpenMP 4.0:
- List items of map clauses in the same construct must not share original
storage.
- If any part of the original storage of a list item has corresponding storage
in the enclosing device data environment, all of the original storage must have
corresponding storage in the enclosing device data environment.

The first one that map(p[7:20]) and map(tofrom:A) share original storage, and
the second one that A[0:4] is already mapped, and you are mapping whole A.

The fix is simple, add map(A[0:4]) to omp target.  It really will not map
anything, just bump the reference counts, because it is already mapped, but
will avoid the implicit mapping of the whole A.

Reply via email to