https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127186
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> --- Created attachment 65482 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65482&action=edit Testcase that uses pointer attachment to global variable First a correction: * The 'always' issue of comment 0 is a real issue → must be implemented for 'target data' and 'target' → currently prints a 'sorry' → first example in comment 0 is about this issue → libgomp.c++/for-24.C is a test, libgomp.c/usm_env_handling-1.c after removing the 'SKIP' as well * Using static global variables inside 'target' actually refers the device variable – the second example of comment 0 actually should work. The commit of comment 1 adds a testcase for this. * There is still an issue with pointer attachment - seemingly also without 'always'. The attached testcase works with host fallback and with honoring map clauses - but fails with GOMP_RUNTIME_USM=enabled as only the variable updated with 'target update' matches the expected result. Note: The example seems to use 'attach', possibly also other map types might be affected, e.g. GOMP_MAP_TO_PSET, GOMP_MAP_ALWAYS_POINTER, GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION, ... which needs to be checked. Note 2: This can be also be mixed with features like iterator ('interator(i=1:10), to: pa[i][:0]') - or mapper, i.e. this needs to be checked as well.
