Hi!

The reduction clause should be copied as map (tofrom: ) to combined target if
present, but as we need different handling of array sections between map and 
reduction,
doing that during gimplification would be harder.

So, this patch adds them during splitting, and similarly to firstprivate adds 
them
with a new flag that they should be just ignored/removed if an explicit map 
clause
of the same list item is present.

The exact rules are to be decided in https://github.com/OpenMP/spec/issues/2766
so this patch just implements something that is IMHO reasonable and exact 
detailed
testcases for the cornercases will follow once it is clarified.

Bootstrapped/regtested on x86_64-linux, committed to trunk.

2021-05-28  Jakub Jelinek  <ja...@redhat.com>

        PR middle-end/99928
gcc/
        * tree.h (OMP_CLAUSE_MAP_IMPLICIT): Define.
gcc/c-family/
        * c-omp.c (c_omp_split_clauses): For reduction clause if combined with
        target add a map tofrom clause with OMP_CLAUSE_MAP_IMPLICIT.
gcc/c/
        * c-typeck.c (handle_omp_array_sections): Copy OMP_CLAUSE_MAP_IMPLICIT.
        (c_finish_omp_clauses): Move not just OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT
        marked clauses last, but also OMP_CLAUSE_MAP_IMPLICIT.  Add
        map_firstprivate_head bitmap, set it for GOMP_MAP_FIRSTPRIVATE_POINTER
        maps and silently remove OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT if it is
        present too.  For OMP_CLAUSE_MAP_IMPLICIT silently remove the clause
        if present in map_head, map_field_head or map_firstprivate_head
        bitmaps.
gcc/cp/
        * semantics.c (handle_omp_array_sections): Copy
        OMP_CLAUSE_MAP_IMPLICIT.
        (finish_omp_clauses): Move not just OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT
        marked clauses last, but also OMP_CLAUSE_MAP_IMPLICIT.  Add
        map_firstprivate_head bitmap, set it for GOMP_MAP_FIRSTPRIVATE_POINTER
        maps and silently remove OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT if it is
        present too.  For OMP_CLAUSE_MAP_IMPLICIT silently remove the clause
        if present in map_head, map_field_head or map_firstprivate_head
        bitmaps.
gcc/testsuite/
        * c-c++-common/gomp/pr99928-8.c: Remove all xfails.
        * c-c++-common/gomp/pr99928-9.c: Likewise.
        * c-c++-common/gomp/pr99928-10.c: Likewise.
        * c-c++-common/gomp/pr99928-16.c: New test.

--- gcc/tree.h.jj       2021-05-26 15:39:15.715315698 +0200
+++ gcc/tree.h  2021-05-26 16:38:26.844260892 +0200
@@ -1654,6 +1654,11 @@ class auto_suppress_location_wrappers
    variable.  */
 #define OMP_CLAUSE_MAP_IN_REDUCTION(NODE) \
   TREE_PRIVATE (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP))
+/* Nonzero on map clauses added implicitly for reduction clauses on combined
+   or composite constructs.  They shall be removed if there is an explicit
+   map clause.  */
+#define OMP_CLAUSE_MAP_IMPLICIT(NODE) \
+  (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)->base.default_def_flag)
 
 /* True on an OMP_CLAUSE_USE_DEVICE_PTR with an OpenACC 'if_present'
    clause.  */
--- gcc/c-family/c-omp.c.jj     2021-05-26 15:39:15.638316779 +0200
+++ gcc/c-family/c-omp.c        2021-05-26 16:38:26.845260878 +0200
@@ -1989,6 +1989,16 @@ c_omp_split_clauses (location_t loc, enu
                        "%<parallel for%>, %<parallel for simd%>");
              OMP_CLAUSE_REDUCTION_INSCAN (clauses) = 0;
            }
+         if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_MAP)) != 0)
+           {
+             c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses),
+                                   OMP_CLAUSE_MAP);
+             OMP_CLAUSE_DECL (c) = OMP_CLAUSE_DECL (clauses);
+             OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_TOFROM);
+             OMP_CLAUSE_MAP_IMPLICIT (c) = 1;
+             OMP_CLAUSE_CHAIN (c) = cclauses[C_OMP_CLAUSE_SPLIT_TARGET];
+             cclauses[C_OMP_CLAUSE_SPLIT_TARGET] = c;
+           }
          if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_SCHEDULE)) != 0)
            {
              if (code == OMP_SIMD)
--- gcc/c/c-typeck.c.jj 2021-05-21 21:16:03.081850728 +0200
+++ gcc/c/c-typeck.c    2021-05-27 15:08:36.348687925 +0200
@@ -13646,6 +13646,7 @@ handle_omp_array_sections (tree c, enum
        OMP_CLAUSE_SET_MAP_KIND (c2, GOMP_MAP_ATTACH_DETACH);
       else
        OMP_CLAUSE_SET_MAP_KIND (c2, GOMP_MAP_FIRSTPRIVATE_POINTER);
+      OMP_CLAUSE_MAP_IMPLICIT (c2) = OMP_CLAUSE_MAP_IMPLICIT (c);
       if (OMP_CLAUSE_MAP_KIND (c2) != GOMP_MAP_FIRSTPRIVATE_POINTER
          && !c_mark_addressable (t))
        return false;
@@ -13916,7 +13917,8 @@ tree
 c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
 {
   bitmap_head generic_head, firstprivate_head, lastprivate_head;
-  bitmap_head aligned_head, map_head, map_field_head, oacc_reduction_head;
+  bitmap_head aligned_head, map_head, map_field_head, map_firstprivate_head;
+  bitmap_head oacc_reduction_head;
   tree c, t, type, *pc;
   tree simdlen = NULL_TREE, safelen = NULL_TREE;
   bool branch_seen = false;
@@ -13936,7 +13938,7 @@ c_finish_omp_clauses (tree clauses, enum
      has been seen, -2 if mixed inscan/normal reduction diagnosed.  */
   int reduction_seen = 0;
   bool allocate_seen = false;
-  bool firstprivate_implicit_moved = false;
+  bool implicit_moved = false;
 
   bitmap_obstack_initialize (NULL);
   bitmap_initialize (&generic_head, &bitmap_default_obstack);
@@ -13946,6 +13948,7 @@ c_finish_omp_clauses (tree clauses, enum
   /* If ort == C_ORT_OMP_DECLARE_SIMD used as uniform_head instead.  */
   bitmap_initialize (&map_head, &bitmap_default_obstack);
   bitmap_initialize (&map_field_head, &bitmap_default_obstack);
+  bitmap_initialize (&map_firstprivate_head, &bitmap_default_obstack);
   /* If ort == C_ORT_OMP used as nontemporal_head or use_device_xxx_head
      instead.  */
   bitmap_initialize (&oacc_reduction_head, &bitmap_default_obstack);
@@ -14378,28 +14381,36 @@ c_finish_omp_clauses (tree clauses, enum
          break;
 
        case OMP_CLAUSE_FIRSTPRIVATE:
-         if (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c)
-             && !firstprivate_implicit_moved)
+         if (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c) && !implicit_moved)
            {
-             firstprivate_implicit_moved = true;
-             /* Move firstprivate clauses with
-                OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT set to the end of
+           move_implicit:
+             implicit_moved = true;
+             /* Move firstprivate and map clauses with
+                OMP_CLAUSE_{FIRSTPRIVATE,MAP}_IMPLICIT set to the end of
                 clauses chain.  */
-             tree cl = NULL, *pc1 = pc, *pc2 = &cl;
+             tree cl1 = NULL_TREE, cl2 = NULL_TREE;
+             tree *pc1 = pc, *pc2 = &cl1, *pc3 = &cl2;
              while (*pc1)
                if (OMP_CLAUSE_CODE (*pc1) == OMP_CLAUSE_FIRSTPRIVATE
                    && OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (*pc1))
                  {
+                   *pc3 = *pc1;
+                   pc3 = &OMP_CLAUSE_CHAIN (*pc3);
+                   *pc1 = OMP_CLAUSE_CHAIN (*pc1);
+                 }
+               else if (OMP_CLAUSE_CODE (*pc1) == OMP_CLAUSE_MAP
+                        && OMP_CLAUSE_MAP_IMPLICIT (*pc1))
+                 {
                    *pc2 = *pc1;
                    pc2 = &OMP_CLAUSE_CHAIN (*pc2);
                    *pc1 = OMP_CLAUSE_CHAIN (*pc1);
                  }
                else
                  pc1 = &OMP_CLAUSE_CHAIN (*pc1);
-             *pc2 = NULL;
-             *pc1 = cl;
-             if (pc1 != pc)
-               continue;
+             *pc3 = NULL;
+             *pc2 = cl2;
+             *pc1 = cl1;
+             continue;
            }
          t = OMP_CLAUSE_DECL (c);
          need_complete = true;
@@ -14410,6 +14421,10 @@ c_finish_omp_clauses (tree clauses, enum
                        "%qE is not a variable in clause %<firstprivate%>", t);
              remove = true;
            }
+         else if (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c)
+                  && !OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET (c)
+                  && bitmap_bit_p (&map_firstprivate_head, DECL_UID (t)))
+           remove = true;
          else if (bitmap_bit_p (&generic_head, DECL_UID (t))
                   || bitmap_bit_p (&firstprivate_head, DECL_UID (t)))
            {
@@ -14653,6 +14668,9 @@ c_finish_omp_clauses (tree clauses, enum
          break;
 
        case OMP_CLAUSE_MAP:
+         if (OMP_CLAUSE_MAP_IMPLICIT (c) && !implicit_moved)
+           goto move_implicit;
+         /* FALLTHRU */
        case OMP_CLAUSE_TO:
        case OMP_CLAUSE_FROM:
        case OMP_CLAUSE__CACHE_:
@@ -14686,6 +14704,16 @@ c_finish_omp_clauses (tree clauses, enum
                    {
                      while (TREE_CODE (t) == COMPONENT_REF)
                        t = TREE_OPERAND (t, 0);
+                     if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
+                         && OMP_CLAUSE_MAP_IMPLICIT (c)
+                         && (bitmap_bit_p (&map_head, DECL_UID (t))
+                             || bitmap_bit_p (&map_field_head, DECL_UID (t))
+                             || bitmap_bit_p (&map_firstprivate_head,
+                                              DECL_UID (t))))
+                       {
+                         remove = true;
+                         break;
+                       }
                      if (bitmap_bit_p (&map_field_head, DECL_UID (t)))
                        break;
                      if (bitmap_bit_p (&map_head, DECL_UID (t)))
@@ -14840,6 +14868,12 @@ c_finish_omp_clauses (tree clauses, enum
              remove = true;
            }
          else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
+                  && OMP_CLAUSE_MAP_IMPLICIT (c)
+                  && (bitmap_bit_p (&map_head, DECL_UID (t))
+                      || bitmap_bit_p (&map_field_head, DECL_UID (t))
+                      || bitmap_bit_p (&map_firstprivate_head, DECL_UID (t))))
+           remove = true;
+         else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
                   && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_FIRSTPRIVATE_POINTER)
            {
              if (bitmap_bit_p (&generic_head, DECL_UID (t))
@@ -14860,7 +14894,10 @@ c_finish_omp_clauses (tree clauses, enum
                  remove = true;
                }
              else
-               bitmap_set_bit (&generic_head, DECL_UID (t));
+               {
+                 bitmap_set_bit (&generic_head, DECL_UID (t));
+                 bitmap_set_bit (&map_firstprivate_head, DECL_UID (t));
+               }
            }
          else if (bitmap_bit_p (&map_head, DECL_UID (t))
                   && (ort != C_ORT_OMP
--- gcc/cp/semantics.c.jj       2021-05-21 21:16:03.082850717 +0200
+++ gcc/cp/semantics.c  2021-05-27 15:58:39.414215458 +0200
@@ -5540,6 +5540,7 @@ handle_omp_array_sections (tree c, enum
            }
          else
            OMP_CLAUSE_SET_MAP_KIND (c2, GOMP_MAP_FIRSTPRIVATE_POINTER);
+         OMP_CLAUSE_MAP_IMPLICIT (c2) = OMP_CLAUSE_MAP_IMPLICIT (c);
          if (OMP_CLAUSE_MAP_KIND (c2) != GOMP_MAP_FIRSTPRIVATE_POINTER
              && !cxx_mark_addressable (t))
            return false;
@@ -5566,6 +5567,7 @@ handle_omp_array_sections (tree c, enum
              tree c3 = build_omp_clause (OMP_CLAUSE_LOCATION (c),
                                          OMP_CLAUSE_MAP);
              OMP_CLAUSE_SET_MAP_KIND (c3, OMP_CLAUSE_MAP_KIND (c2));
+             OMP_CLAUSE_MAP_IMPLICIT (c2) = OMP_CLAUSE_MAP_IMPLICIT (c);
              OMP_CLAUSE_DECL (c3) = ptr;
              if (OMP_CLAUSE_MAP_KIND (c2) == GOMP_MAP_ALWAYS_POINTER
                  || OMP_CLAUSE_MAP_KIND (c2) == GOMP_MAP_ATTACH_DETACH)
@@ -6502,7 +6504,8 @@ tree
 finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
 {
   bitmap_head generic_head, firstprivate_head, lastprivate_head;
-  bitmap_head aligned_head, map_head, map_field_head, oacc_reduction_head;
+  bitmap_head aligned_head, map_head, map_field_head, map_firstprivate_head;
+  bitmap_head oacc_reduction_head;
   tree c, t, *pc;
   tree safelen = NULL_TREE;
   bool branch_seen = false;
@@ -6519,7 +6522,7 @@ finish_omp_clauses (tree clauses, enum c
   bool allocate_seen = false;
   tree detach_seen = NULL_TREE;
   bool mergeable_seen = false;
-  bool firstprivate_implicit_moved = false;
+  bool implicit_moved = false;
 
   bitmap_obstack_initialize (NULL);
   bitmap_initialize (&generic_head, &bitmap_default_obstack);
@@ -6529,6 +6532,7 @@ finish_omp_clauses (tree clauses, enum c
   /* If ort == C_ORT_OMP_DECLARE_SIMD used as uniform_head instead.  */
   bitmap_initialize (&map_head, &bitmap_default_obstack);
   bitmap_initialize (&map_field_head, &bitmap_default_obstack);
+  bitmap_initialize (&map_firstprivate_head, &bitmap_default_obstack);
   /* If ort == C_ORT_OMP used as nontemporal_head or use_device_xxx_head
      instead.  */
   bitmap_initialize (&oacc_reduction_head, &bitmap_default_obstack);
@@ -6844,28 +6848,36 @@ finish_omp_clauses (tree clauses, enum c
          break;
 
        case OMP_CLAUSE_FIRSTPRIVATE:
-         if (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c)
-             && !firstprivate_implicit_moved)
+         if (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c) && !implicit_moved)
            {
-             firstprivate_implicit_moved = true;
-             /* Move firstprivate clauses with
-                OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT set to the end of
+           move_implicit:
+             implicit_moved = true;
+             /* Move firstprivate and map clauses with
+                OMP_CLAUSE_{FIRSTPRIVATE,MAP}_IMPLICIT set to the end of
                 clauses chain.  */
-             tree cl = NULL, *pc1 = pc, *pc2 = &cl;
+             tree cl1 = NULL_TREE, cl2 = NULL_TREE;
+             tree *pc1 = pc, *pc2 = &cl1, *pc3 = &cl2;
              while (*pc1)
                if (OMP_CLAUSE_CODE (*pc1) == OMP_CLAUSE_FIRSTPRIVATE
                    && OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (*pc1))
                  {
+                   *pc3 = *pc1;
+                   pc3 = &OMP_CLAUSE_CHAIN (*pc3);
+                   *pc1 = OMP_CLAUSE_CHAIN (*pc1);
+                 }
+               else if (OMP_CLAUSE_CODE (*pc1) == OMP_CLAUSE_MAP
+                        && OMP_CLAUSE_MAP_IMPLICIT (*pc1))
+                 {
                    *pc2 = *pc1;
                    pc2 = &OMP_CLAUSE_CHAIN (*pc2);
                    *pc1 = OMP_CLAUSE_CHAIN (*pc1);
                  }
                else
                  pc1 = &OMP_CLAUSE_CHAIN (*pc1);
-             *pc2 = NULL;
-             *pc1 = cl;
-             if (pc1 != pc)
-               continue;
+             *pc3 = NULL;
+             *pc2 = cl2;
+             *pc1 = cl1;
+             continue;
            }
          t = omp_clause_decl_field (OMP_CLAUSE_DECL (c));
          if (t)
@@ -6896,6 +6908,10 @@ finish_omp_clauses (tree clauses, enum c
                          t);
              remove = true;
            }
+         else if (OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (c)
+                  && !OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT_TARGET (c)
+                  && bitmap_bit_p (&map_firstprivate_head, DECL_UID (t)))
+           remove = true;
          else if (bitmap_bit_p (&generic_head, DECL_UID (t))
                   || bitmap_bit_p (&firstprivate_head, DECL_UID (t)))
            {
@@ -7601,6 +7617,9 @@ finish_omp_clauses (tree clauses, enum c
          break;
 
        case OMP_CLAUSE_MAP:
+         if (OMP_CLAUSE_MAP_IMPLICIT (c) && !implicit_moved)
+           goto move_implicit;
+         /* FALLTHRU */
        case OMP_CLAUSE_TO:
        case OMP_CLAUSE_FROM:
        case OMP_CLAUSE__CACHE_:
@@ -7632,6 +7651,16 @@ finish_omp_clauses (tree clauses, enum c
                        t = TREE_OPERAND (t, 0);
                      if (REFERENCE_REF_P (t))
                        t = TREE_OPERAND (t, 0);
+                     if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
+                         && OMP_CLAUSE_MAP_IMPLICIT (c)
+                         && (bitmap_bit_p (&map_head, DECL_UID (t))
+                             || bitmap_bit_p (&map_field_head, DECL_UID (t))
+                             || bitmap_bit_p (&map_firstprivate_head,
+                                              DECL_UID (t))))
+                       {
+                         remove = true;
+                         break;
+                       }
                      if (bitmap_bit_p (&map_field_head, DECL_UID (t)))
                        break;
                      if (bitmap_bit_p (&map_head, DECL_UID (t)))
@@ -7812,6 +7841,13 @@ finish_omp_clauses (tree clauses, enum c
                        "%qD is not a pointer variable", t);
              remove = true;
            }
+         else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
+                  && OMP_CLAUSE_MAP_IMPLICIT (c)
+                  && (bitmap_bit_p (&map_head, DECL_UID (t))
+                      || bitmap_bit_p (&map_field_head, DECL_UID (t))
+                      || bitmap_bit_p (&map_firstprivate_head,
+                                       DECL_UID (t))))
+           remove = true;
          else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
                   && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_FIRSTPRIVATE_POINTER)
            {
@@ -7833,7 +7869,10 @@ finish_omp_clauses (tree clauses, enum c
                  remove = true;
                }
              else
-               bitmap_set_bit (&generic_head, DECL_UID (t));
+               {
+                 bitmap_set_bit (&generic_head, DECL_UID (t));
+                 bitmap_set_bit (&map_firstprivate_head, DECL_UID (t));
+               }
            }
          else if (bitmap_bit_p (&map_head, DECL_UID (t))
                   && !bitmap_bit_p (&map_field_head, DECL_UID (t)))
--- gcc/testsuite/c-c++-common/gomp/pr99928-8.c.jj      2021-05-26 
15:39:15.707315810 +0200
+++ gcc/testsuite/c-c++-common/gomp/pr99928-8.c 2021-05-26 16:38:26.844260892 
+0200
@@ -94,48 +94,48 @@ bar (void)
     #pragma omp section
     r12++;
   }
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r13" 
"gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r13\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r13" 
"gimple" } } */
+  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r13\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r13\\)" 
"gimple" } } */
   #pragma omp target parallel reduction(+:r13)
   r13++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r14" 
"gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r14\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r14" 
"gimple" } } */
+  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r14\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r14\\)" 
"gimple" } } *//* FIXME: This should be on for instead.  */
   /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r14\\)" 
"gimple" } } *//* FIXME.  */
   #pragma omp target parallel for reduction(+:r14)
   for (int i = 0; i < 64; i++)
     r14++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r15" 
"gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r15\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r15" 
"gimple" } } */
+  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r15\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r15\\)" 
"gimple" } } *//* FIXME: This should be on for instead.  */
   /* { dg-final { scan-tree-dump-not "omp for\[^\n\r]*reduction\\(\\+:r15\\)" 
"gimple" } } *//* FIXME.  */
   /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r15\\)" 
"gimple" } } */
   #pragma omp target parallel for simd reduction(+:r15)
   for (int i = 0; i < 64; i++)
     r15++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r16" 
"gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r16\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r16" 
"gimple" } } */
+  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r16\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r16\\)" 
"gimple" } } */
   /* { dg-final { scan-tree-dump "omp for\[^\n\r]*reduction\\(\\+:r16\\)" 
"gimple" } } *//* NOTE: This is implementation detail.  */
   /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r16\\)" 
"gimple" } } *//* NOTE: This is implementation detail.  */
   #pragma omp target parallel loop reduction(+:r16)
   for (int i = 0; i < 64; i++)
     r16++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r17" 
"gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r17\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r17" 
"gimple" } } */
+  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r17\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r17\\)" 
"gimple" } } */
   #pragma omp target teams reduction(+:r17)
   r17++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r18" 
"gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r18\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r18" 
"gimple" } } */
+  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r18\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r18\\)" 
"gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
distribute\[^\n\r]*reduction\\(\\+:r18\\)" "gimple" } } */
   #pragma omp target teams distribute reduction(+:r18)
   for (int i = 0; i < 64; i++)
     r18++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r19" 
"gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r19\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r19" 
"gimple" } } */
+  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r19\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r19\\)" 
"gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
distribute\[^\n\r]*reduction\\(\\+:r19\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r19\\)" 
"gimple" } } *//* FIXME: This should be on for instead.  */
@@ -143,8 +143,8 @@ bar (void)
   #pragma omp target teams distribute parallel for reduction(+:r19)
   for (int i = 0; i < 64; i++)
     r19++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r20" 
"gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r20\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r20" 
"gimple" } } */
+  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r20\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r20\\)" 
"gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
distribute\[^\n\r]*reduction\\(\\+:r20\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*reduction\\(\\+:r20\\)" 
"gimple" } } *//* FIXME: This should be on for instead.  */
@@ -153,16 +153,16 @@ bar (void)
   #pragma omp target teams distribute parallel for simd reduction(+:r20)
   for (int i = 0; i < 64; i++)
     r20++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r21" 
"gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r21\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r21" 
"gimple" } } */
+  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r21\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*reduction\\(\\+:r21\\)" 
"gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
distribute\[^\n\r]*reduction\\(\\+:r21\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r21\\)" 
"gimple" } } */
   #pragma omp target teams distribute simd reduction(+:r21)
   for (int i = 0; i < 64; i++)
     r21++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r22" 
"gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r22\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r22" 
"gimple" } } */
+  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r22\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(r22\\)" "gimple" 
} } */
   /* { dg-final { scan-tree-dump "omp 
distribute\[^\n\r]*reduction\\(\\+:r22\\)" "gimple" } } *//* NOTE: This is 
implementation detail.  */
   /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r22\\)" 
"gimple" } } *//* NOTE: This is implementation detail.  */
@@ -171,8 +171,8 @@ bar (void)
   #pragma omp target teams loop reduction(+:r22)
   for (int i = 0; i < 64; i++)
     r22++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r23" 
"gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r23\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r23" 
"gimple" } } */
+  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r23\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp simd\[^\n\r]*reduction\\(\\+:r23\\)" 
"gimple" } } */
   #pragma omp target simd reduction(+:r23)
   for (int i = 0; i < 64; i++)
--- gcc/testsuite/c-c++-common/gomp/pr99928-9.c.jj      2021-05-26 
15:39:15.707315810 +0200
+++ gcc/testsuite/c-c++-common/gomp/pr99928-9.c 2021-05-26 16:38:26.843260906 
+0200
@@ -94,19 +94,19 @@ bar (void)
     #pragma omp section
     r12[1]++;
   }
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r13\\\[1\\\] 
\\\[len: 8\\\]" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r13\\\[1\\\] 
\\\[len: 8\\\]" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r13\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp 
parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r13 \\+ 4" "gimple" } } */
   #pragma omp target parallel reduction(+:r13[1:2])
   r13[1]++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r14\\\[1\\\] 
\\\[len: 8\\\]" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r14\\\[1\\\] 
\\\[len: 8\\\]" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r14" 
"gimple" } } */
   /* { dg-final { scan-tree-dump "omp 
parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r14 \\+ 4" "gimple" } } *//* 
FIXME: This should be on for instead.  */
   /* { dg-final { scan-tree-dump-not "omp 
for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r14 \\+ 4" "gimple" } } *//* FIXME.  */
   #pragma omp target parallel for reduction(+:r14[1:2])
   for (int i = 0; i < 64; i++)
     r14[1]++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r15\\\[1\\\] 
\\\[len: 8\\\]" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r15\\\[1\\\] 
\\\[len: 8\\\]" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r15\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp 
parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r15 \\+ 4" "gimple" } } *//* 
FIXME: This should be on for instead.  */
   /* { dg-final { scan-tree-dump-not "omp 
for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r15 \\+ 4" "gimple" } } *//* FIXME.  */
@@ -114,7 +114,7 @@ bar (void)
   #pragma omp target parallel for simd reduction(+:r15[1:2])
   for (int i = 0; i < 64; i++)
     r15[1]++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r16\\\[1\\\] 
\\\[len: 8\\\]" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r16\\\[1\\\] 
\\\[len: 8\\\]" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r16\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*shared\\(r16\\)" 
"gimple" } } */
   /* { dg-final { scan-tree-dump "omp 
for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r16 \\+ 4" "gimple" } } *//* NOTE: 
This is implementation detail.  */
@@ -122,19 +122,19 @@ bar (void)
   #pragma omp target parallel loop reduction(+:r16[1:2])
   for (int i = 0; i < 64; i++)
     r16[1]++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r17\\\[1\\\] 
\\\[len: 8\\\]" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r17\\\[1\\\] 
\\\[len: 8\\\]" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r17\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp 
teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r17 \\+ 4" "gimple" } } */
   #pragma omp target teams reduction(+:r17[1:2])
   r17[1]++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r18\\\[1\\\] 
\\\[len: 8\\\]" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r18\\\[1\\\] 
\\\[len: 8\\\]" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r18\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp 
teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r18 \\+ 4" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r18 \\+ 4" "gimple" } } */
   #pragma omp target teams distribute reduction(+:r18[1:2])
   for (int i = 0; i < 64; i++)
     r18[1]++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r19\\\[1\\\] 
\\\[len: 8\\\]" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r19\\\[1\\\] 
\\\[len: 8\\\]" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r19\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp 
teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r19 \\+ 4" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r19 \\+ 4" "gimple" } } */
@@ -143,7 +143,7 @@ bar (void)
   #pragma omp target teams distribute parallel for reduction(+:r19[1:2])
   for (int i = 0; i < 64; i++)
     r19[1]++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r20\\\[1\\\] 
\\\[len: 8\\\]" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r20\\\[1\\\] 
\\\[len: 8\\\]" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r20\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp 
teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r20 \\+ 4" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r20 \\+ 4" "gimple" } } */
@@ -153,7 +153,7 @@ bar (void)
   #pragma omp target teams distribute parallel for simd reduction(+:r20[1:2])
   for (int i = 0; i < 64; i++)
     r20[1]++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r21\\\[1\\\] 
\\\[len: 8\\\]" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r21\\\[1\\\] 
\\\[len: 8\\\]" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r21\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp 
teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r21 \\+ 4" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r21 \\+ 4" "gimple" } } */
@@ -161,7 +161,7 @@ bar (void)
   #pragma omp target teams distribute simd reduction(+:r21[1:2])
   for (int i = 0; i < 64; i++)
     r21[1]++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r22\\\[1\\\] 
\\\[len: 8\\\]" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r22\\\[1\\\] 
\\\[len: 8\\\]" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r22\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*shared\\(r22\\)" "gimple" 
} } */
   /* { dg-final { scan-tree-dump "omp 
distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r22 \\+ 4" "gimple" } } *//* 
NOTE: This is implementation detail.  */
@@ -171,7 +171,7 @@ bar (void)
   #pragma omp target teams loop reduction(+:r22[1:2])
   for (int i = 0; i < 64; i++)
     r22[1]++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r23\\\[1\\\] 
\\\[len: 8\\\]" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:r23\\\[1\\\] 
\\\[len: 8\\\]" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r23\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp 
simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*&r23 \\+ 4" "gimple" } } */
   #pragma omp target simd reduction(+:r23[1:2])
--- gcc/testsuite/c-c++-common/gomp/pr99928-10.c.jj     2021-05-26 
15:39:15.707315810 +0200
+++ gcc/testsuite/c-c++-common/gomp/pr99928-10.c        2021-05-26 
16:38:26.844260892 +0200
@@ -95,22 +95,22 @@ bar (void)
     #pragma omp section
     r12[1]++;
   }
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* 
\\\[len: 60\\\]" "gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r13 
\\\[pointer assign, bias: 4\\\]\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* 
\\\[len: 60\\\]" "gimple" } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r13 
\\\[pointer assign, bias: 4\\\]\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r13\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp 
parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r13 \\+ 4" "gimple" } } */
   #pragma omp target parallel reduction(+:r13[1:15])
   r13[1]++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* 
\\\[len: 64\\\]" "gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r14 
\\\[pointer assign, bias: 4\\\]\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* 
\\\[len: 64\\\]" "gimple" } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r14 
\\\[pointer assign, bias: 4\\\]\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp target\[^\n\r]*firstprivate\\(r14" 
"gimple" } } */
   /* { dg-final { scan-tree-dump "omp 
parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r14 \\+ 4" "gimple" } } *//* 
FIXME: This should be on for instead.  */
   /* { dg-final { scan-tree-dump-not "omp 
for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r14 \\+ 4" "gimple" } } *//* FIXME.  
*/
   #pragma omp target parallel for reduction(+:r14[1:16])
   for (int i = 0; i < 64; i++)
     r14[1]++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* 
\\\[len: 68\\\]" "gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r15 
\\\[pointer assign, bias: 4\\\]\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* 
\\\[len: 68\\\]" "gimple" } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r15 
\\\[pointer assign, bias: 4\\\]\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r15\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp 
parallel\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r15 \\+ 4" "gimple" } } *//* 
FIXME: This should be on for instead.  */
   /* { dg-final { scan-tree-dump-not "omp 
for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r15 \\+ 4" "gimple" } } *//* FIXME.  
*/
@@ -118,31 +118,31 @@ bar (void)
   #pragma omp target parallel for simd reduction(+:r15[1:17])
   for (int i = 0; i < 64; i++)
     r15[1]++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* 
\\\[len: 72\\\]" "gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r16 
\\\[pointer assign, bias: 4\\\]\\)" "gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r16\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* 
\\\[len: 72\\\]" "gimple" } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r16 
\\\[pointer assign, bias: 4\\\]\\)" "gimple" } } */
+  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r16\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(r16\\)" 
"gimple" } } *//* FIXME: Should be shared, but firstprivate is an optimization. 
 */
   /* { dg-final { scan-tree-dump "omp 
for\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r16 \\+ 4" "gimple" } } *//* NOTE: 
This is implementation detail.  */
   /* { dg-final { scan-tree-dump "omp 
simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r16 \\+ 4" "gimple" } } *//* NOTE: 
This is implementation detail.  */
   #pragma omp target parallel loop reduction(+:r16[1:18])
   for (int i = 0; i < 64; i++)
     r16[1]++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* 
\\\[len: 76\\\]" "gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r17 
\\\[pointer assign, bias: 4\\\]\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* 
\\\[len: 76\\\]" "gimple" } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r17 
\\\[pointer assign, bias: 4\\\]\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r17\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp 
teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r17 \\+ 4" "gimple" } } */
   #pragma omp target teams reduction(+:r17[1:19])
   r17[1]++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* 
\\\[len: 80\\\]" "gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r18 
\\\[pointer assign, bias: 4\\\]\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* 
\\\[len: 80\\\]" "gimple" } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r18 
\\\[pointer assign, bias: 4\\\]\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r18\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp 
teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r18 \\+ 4" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r18 \\+ 4" "gimple" } } */
   #pragma omp target teams distribute reduction(+:r18[1:20])
   for (int i = 0; i < 64; i++)
     r18[1]++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* 
\\\[len: 84\\\]" "gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r19 
\\\[pointer assign, bias: 4\\\]\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* 
\\\[len: 84\\\]" "gimple" } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r19 
\\\[pointer assign, bias: 4\\\]\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r19\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp 
teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r19 \\+ 4" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r19 \\+ 4" "gimple" } } */
@@ -151,8 +151,8 @@ bar (void)
   #pragma omp target teams distribute parallel for reduction(+:r19[1:21])
   for (int i = 0; i < 64; i++)
     r19[1]++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* 
\\\[len: 88\\\]" "gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r20 
\\\[pointer assign, bias: 4\\\]\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* 
\\\[len: 88\\\]" "gimple" } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r20 
\\\[pointer assign, bias: 4\\\]\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r20\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp 
teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r20 \\+ 4" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r20 \\+ 4" "gimple" } } */
@@ -162,8 +162,8 @@ bar (void)
   #pragma omp target teams distribute parallel for simd reduction(+:r20[1:22])
   for (int i = 0; i < 64; i++)
     r20[1]++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* 
\\\[len: 92\\\]" "gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r21 
\\\[pointer assign, bias: 4\\\]\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* 
\\\[len: 92\\\]" "gimple" } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r21 
\\\[pointer assign, bias: 4\\\]\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r21\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp 
teams\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r21 \\+ 4" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r21 \\+ 4" "gimple" } } */
@@ -171,9 +171,9 @@ bar (void)
   #pragma omp target teams distribute simd reduction(+:r21[1:23])
   for (int i = 0; i < 64; i++)
     r21[1]++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* 
\\\[len: 96\\\]" "gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r22 
\\\[pointer assign, bias: 4\\\]\\)" "gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r22\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* 
\\\[len: 96\\\]" "gimple" } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r22 
\\\[pointer assign, bias: 4\\\]\\)" "gimple" } } */
+  /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r22\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp teams\[^\n\r]*firstprivate\\(r22\\)" 
"gimple" } } *//* FIXME: Should be shared, but firstprivate is an optimization. 
 */
   /* { dg-final { scan-tree-dump "omp 
distribute\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r22 \\+ 4" "gimple" } } *//* 
NOTE: This is implementation detail.  */
   /* { dg-final { scan-tree-dump "omp parallel\[^\n\r]*firstprivate\\(r22\\)" 
"gimple" } } *//* NOTE: This is implementation detail.  */
@@ -182,8 +182,8 @@ bar (void)
   #pragma omp target teams loop reduction(+:r22[1:24])
   for (int i = 0; i < 64; i++)
     r22[1]++;
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* 
\\\[len: 100\\\]" "gimple" { xfail *-*-* } } } */
-  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r23 
\\\[pointer assign, bias: 4\\\]\\)" "gimple" { xfail *-*-* } } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(tofrom:\\\*_\[0-9]* 
\\\[len: 100\\\]" "gimple" } } */
+  /* { dg-final { scan-tree-dump "omp target\[^\n\r]*map\\(firstprivate:r23 
\\\[pointer assign, bias: 4\\\]\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump-not "omp 
target\[^\n\r]*firstprivate\\(r23\\)" "gimple" } } */
   /* { dg-final { scan-tree-dump "omp 
simd\[^\n\r]*reduction\\(\\+:MEM\[^\n\r]*\\)r23 \\+ 4" "gimple" } } */
   #pragma omp target simd reduction(+:r23[1:25])
--- gcc/testsuite/c-c++-common/gomp/pr99928-16.c.jj     2021-05-27 
16:39:11.482106791 +0200
+++ gcc/testsuite/c-c++-common/gomp/pr99928-16.c        2021-05-27 
16:38:50.212412928 +0200
@@ -0,0 +1,16 @@
+/* PR middle-end/99928 */
+
+void
+foo (void)
+{
+  int a[6] = {};
+  #pragma omp target simd reduction(+:a[:3])
+  for (int i = 0; i < 6; i++)
+    a[0]++;
+  #pragma omp target simd reduction(+:a[:3]) map(always, tofrom: a)
+  for (int i = 0; i < 6; i++)
+    a[0]++;
+  #pragma omp target simd reduction(+:a[:3]) map(always, tofrom: a[:6])
+  for (int i = 0; i < 6; i++)
+    a[0]++;
+}

        Jakub

Reply via email to