]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
OpenMP/C++: Fix label mangling in metadirective body [PR122378]
authorPaul-Antoine Arras <parras@baylibre.com>
Fri, 24 Oct 2025 09:05:27 +0000 (11:05 +0200)
committerPaul-Antoine Arras <parras@baylibre.com>
Mon, 27 Oct 2025 14:56:15 +0000 (15:56 +0100)
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.

gcc/cp/parser.cc

index 0917a16a9080ee0074eb6af5da312945c7f1e7d0..58361220bb378c06b43479052c3d72bde1a5984b 100644 (file)
@@ -32724,6 +32724,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.  */