[Bug middle-end/127178] New: [OpenMP] With requires unified_shared_memory/self_maps: missing implicit declare target (link) for variables
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Sep 1 13:39:18 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127178
Bug ID: 127178
Summary: [OpenMP] With requires
unified_shared_memory/self_maps: missing implicit
declare target (link) for variables
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: openmp, rejects-valid
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
Target Milestone: ---
OpenMP states for 'unified_shared_memory' (in OpenMP 6.1):
"The use of declare target directives in an OpenMP program is optional for
referencing variables with static storage duration in device procedures."
The wording is a bit ambiguous about where the variable is defined - inside the
device procedure or not, but it seems to imply global static variables - and,
hence, implicit declare target.
[BTW: The 5.0 wording was: "The unified_shared_memory clause makes the map
clause optional on target constructs and the declare target directive optional
for static lifetime variables accessed inside declare target functions.]
Currently, GCC only handles implicit 'declare target' for functions, seems as
if this needs to be extended to variables as well.
Note: With USM/self_maps, 'declare target' implies the 'link' clause such that
the runtime can make the device side point to the host variable during image
load time.
More information about the Gcc-bugs
mailing list