https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110639
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Testing shows that the offsets are correctly handled but that there is an
ordering problem. Example:
int
main ()
{
int a[100] = {};
int *p = &a[0];
uintptr_t iptr;
#pragma omp target map(a, iptr)
iptr = (uintptr_t) p;
This will fail - as the implicitly added 'firstprivate' arrives too early at
GOMP_target_ext - before 'a' is mapped:
map(alloc:MEM[(char *)p] [len: 0])
map(firstprivate:p [pointer assign, bias: 0])
map(tofrom:iptr [len: 8])
map(tofrom:a [len: 400])
If 'a' is already present on the device (e.g. 'omp target enter data map(a)'),
it works.
Solution: The implicitly mapped C/C++ pointer variable 'p' must be added at the
end of the clauses.