From: Paul-Antoine Arras Date: Fri, 24 Oct 2025 09:05:27 +0000 (+0200) Subject: OpenMP/C++: Fix label mangling in metadirective body [PR122378] X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b8d52c26b578db45a3a57f66d14de7ff17fb7efc;p=thirdparty%2Fgcc.git OpenMP/C++: Fix label mangling in metadirective body [PR122378] Testcase c-c++-common/gomp/attrs-metadirective-2.c failed in C++ when OFFLOAD_TARGET_NAMES=nvptx-none. That was caused by label mangling being applied to the use but not to the declaration. This is now fixed by mangling the declaration as well. PR c++/122378 gcc/cp/ChangeLog: * parser.cc (cp_parser_label_declaration): Mangle label declaration in a metadirective region. (cherry picked from commit d9f720f2ce39b56e91209c0283049f8e0ae8e7fc) --- diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index da65d4e4fcc..9cd5d7cb27f 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -32369,6 +32369,8 @@ cp_parser_label_declaration (cp_parser* parser) /* If we failed, stop. */ if (identifier == error_mark_node) break; + if (parser->omp_metadirective_state) + identifier = mangle_metadirective_region_label (parser, identifier); /* Declare it as a label. */ finish_label_decl (identifier); /* If the next token is a `;', stop. */