OpenMP: Fix 'omp declare target' handling for vars [PR99509]
authorTobias Burnus <tobias@codesourcery.com>
Mon, 15 Mar 2021 09:12:58 +0000 (10:12 +0100)
committerTobias Burnus <tobias@codesourcery.com>
Mon, 15 Mar 2021 09:12:58 +0000 (10:12 +0100)
commitf20fe2cb213dffba47ec1b62c625590b5bbe50d7
treefa3270858cb57054342ce942421477f83e8454eb
parentb516a15371503bae35f2a1c7bc5d7e0c503eefdd
OpenMP: Fix 'omp declare target' handling for vars [PR99509]

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.
gcc/c/c-decl.c
gcc/cp/decl.c
libgomp/testsuite/libgomp.c-c++-common/declare_target-1.c [new file with mode: 0644]