Updated the git commit log as suggested by Thomas. The patch itself remains unchanged.

On 24/10/2025 10:13, Paul-Antoine Arras wrote:
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 middle-end/122378

gcc/cp/ChangeLog:

        * parser.cc (cp_parser_label_declaration): Mangle label declaration in a
        metadirective region.
---
  gcc/cp/parser.cc | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index 0917a16a908..58361220bb3 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -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.  */


--
PA
commit 51be42eadeed957ebb47846f8a1a8c455af86619
Author: Paul-Antoine Arras <[email protected]>
Date:   Fri Oct 24 11:05:27 2025 +0200

    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.

diff --git gcc/cp/parser.cc gcc/cp/parser.cc
index 0917a16a908..58361220bb3 100644
--- gcc/cp/parser.cc
+++ gcc/cp/parser.cc
@@ -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.  */

Reply via email to