f20fe2cb21
For variables with 'declare target' attribute, varpool_node::get_create marks variables as offload; however, if the node already exists, it is not updated. C/C++ may tag decl with 'declare target implicit', which may only be after varpool creation turned into 'declare target' or 'declare target link'; in this case, the tagging has to happen in the FE. gcc/c/ChangeLog: PR c++/99509 * c-decl.c (finish_decl): For 'omp declare target implicit' vars, ensure that the varpool node is marked as offloadable. gcc/cp/ChangeLog: PR c++/99509 * decl.c (cp_finish_decl): For 'omp declare target implicit' vars, ensure that the varpool node is marked as offloadable. libgomp/ChangeLog: PR c++/99509 * testsuite/libgomp.c-c++-common/declare_target-1.c: New test.
23 lines
284 B
C
23 lines
284 B
C
/* PR c++/99509 */
|
|
|
|
#pragma omp declare target
|
|
int data[] = {5};
|
|
#pragma omp end declare target
|
|
|
|
static inline int
|
|
foo (int idx)
|
|
{
|
|
return data[idx];
|
|
}
|
|
|
|
int
|
|
main ()
|
|
{
|
|
int i = -1;
|
|
#pragma omp target map(from:i)
|
|
i = foo(0);
|
|
if (i != 5)
|
|
__builtin_abort ();
|
|
return 0;
|
|
}
|