https://gcc.gnu.org/g:70577c961780f490bcb7f4bc0161d4ac42d6231f

commit r17-1398-g70577c961780f490bcb7f4bc0161d4ac42d6231f
Author: Kwok Cheung Yeung <[email protected]>
Date:   Sun Jun 7 01:37:15 2026 +0000

    openmp, fortran: Move udm field of gfc_omp_namelist into a new union
    
    This patch moves u2.udm into u3.udm.
    
    This is necessary to avoid clashes when mappers are used together with
    iterators, which uses u2.ns.
    
    gcc/fortran/
    
            * gfortran.h (struct gfc_omp_namelist): Move udm field into a new
            union u3.
            * match.cc (gfc_free_omp_namelist): Change reference to u2.udm to
            u3.udm.
            * openmp.cc (gfc_match_omp_clauses): Likewise.
    
    Co-authored-by: Sandra Loosemore <[email protected]>

Diff:
---
 gcc/fortran/gfortran.h | 5 ++++-
 gcc/fortran/match.cc   | 2 +-
 gcc/fortran/openmp.cc  | 2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index d8d8f3faae24..ef6239cd6678 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -1477,13 +1477,16 @@ typedef struct gfc_omp_namelist
   union
     {
       struct gfc_omp_namelist_udr *udr;
-      struct gfc_omp_namelist_udm udm;
       gfc_namespace *ns;
       gfc_expr *allocator;
       struct gfc_symbol *traits_sym;
       struct gfc_omp_namelist *duplicate_of;
       char *init_interop;
     } u2;
+  union
+    {
+      struct gfc_omp_namelist_udm udm;
+    } u3;
   struct gfc_omp_namelist *next;
   locus where;
 }
diff --git a/gcc/fortran/match.cc b/gcc/fortran/match.cc
index 9172f46ed7c2..98b59cc33792 100644
--- a/gcc/fortran/match.cc
+++ b/gcc/fortran/match.cc
@@ -6554,7 +6554,7 @@ gfc_free_omp_namelist (gfc_omp_namelist *name, enum 
gfc_omp_list_type list)
            }
        }
       else if (free_mapper)
-       { } /* For now, u2.udm is not a pointer.  */
+       { } /* For now, u3.udm is not a pointer.  */
       else if (!free_mapper && name->u2.udr)
        {
          if (name->u2.udr->combiner)
diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc
index 476a6604892e..73a96b05cb20 100644
--- a/gcc/fortran/openmp.cc
+++ b/gcc/fortran/openmp.cc
@@ -3856,7 +3856,7 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const 
omp_mask mask,
                        = gfc_find_omp_udm (gfc_current_ns, mapper_id, ts);
                      if (udm)
                        {
-                         n->u2.udm.udm = udm;
+                         n->u3.udm.udm = udm;
                        }
                    }
                  continue;

Reply via email to