https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125367

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Patch that fixes this issue - but reports one error too much for

  #pragma omp target in_reduction(+:i) private(i)

which is invalid + diagnosed - but 'in_direction' additionally adds an implicit
'map(tofrom:i)' clause per OpenMP. For the code above (but seemingly not for
valid cases), the fix below will now yield an additional second error: besides
one for duplicated use in data clauses (i.e. in private and in in_reduction),
there is now another error about data + map clauses, which is surprising.
→ c-c++-common/gomp/target-in-reduction-1.c

Thus, some further work is required.

--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -17936,2 +17936,3 @@ c_finish_omp_clauses (tree clauses, enum
            else if (bitmap_bit_p (&firstprivate_head, DECL_UID (t))
+                    || bitmap_bit_p (&generic_head, DECL_UID (t))
                     || bitmap_bit_p (&is_on_device_head, DECL_UID (t)))
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -9658,2 +9658,3 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type 
    else if (bitmap_bit_p (&firstprivate_head, DECL_UID (t))
+                    || bitmap_bit_p (&generic_head, DECL_UID (t))
                     || bitmap_bit_p (&is_on_device_head, DECL_UID (t)))

Reply via email to