https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102640
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-11 branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:6c3860845c9b6d5863606aa5717fff4bd57a3af6 commit r11-9090-g6c3860845c9b6d5863606aa5717fff4bd57a3af6 Author: Jakub Jelinek <ja...@redhat.com> Date: Fri Oct 8 10:58:56 2021 +0200 openmp: Fix up declare target handling for vars with DECL_LOCAL_DECL_ALIAS [PR102640] The introduction of DECL_LOCAL_DECL_ALIAS and push_local_extern_decl_alias in r11-3699-g4e62aca0e0520e4ed2532f2d8153581190621c1a broke the following testcase. The following patch fixes it by treating similarly not just the variable to or link clause is put on, but also its DECL_LOCAL_DECL_ALIAS if any. If it hasn't been created yet, when it is created it will copy attributes and therefore should get it for free, and as it is an extern, nothing more than attributes is needed for it. 2021-10-08 Jakub Jelinek <ja...@redhat.com> PR c++/102640 gcc/cp/ * parser.c (handle_omp_declare_target_clause): New function. (cp_parser_omp_declare_target): Use it. gcc/testsuite/ * c-c++-common/gomp/pr102640.c: New test. (cherry picked from commit db3d7270b42fe27fb05664c4fdf524ab7ad13a75)