https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99509
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Tobias Burnus <bur...@gcc.gnu.org>: https://gcc.gnu.org/g:f20fe2cb213dffba47ec1b62c625590b5bbe50d7 commit r11-7665-gf20fe2cb213dffba47ec1b62c625590b5bbe50d7 Author: Tobias Burnus <tob...@codesourcery.com> Date: Mon Mar 15 10:12:58 2021 +0100 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.