Description
The following code snippet will cause the external variable a
to be emitted in the IR even though it is not used. See also the godbolt link, https://godbolt.org/z/M5MsrnbnM.
extern int a;
#pragma omp declare target to(a) device_type(host)
int main() { return 0; }
The standard semantics maintain that unused extern variables will not be emitted. This is important for linking as linking in a static library that defines a
will be extracted even though it's unused.
Metadata
Metadata
Assignees
Type
Projects
Status
Done