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

--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #5)
> The problem is (original dump):
>   #pragma omp distribute private(d) lastprivate(d)

If one does not add the 'private(d)', it works: 'private(d)' is added by the ME
only if 'lastprivate(d)' is not present.

Namely, the following patch works – but the question is, whence to add a
clause. (There is more such code.)

--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -4312,7 +4312,5 @@ gfc_trans_omp_do (gfc_code *code, gfc_exec_op op,
stmtblock_t *pblock,
                dovar_found = 2;
-           }
-         else
-           tmp = build_omp_clause (input_location, OMP_CLAUSE_PRIVATE);
          OMP_CLAUSE_DECL (tmp) = dovar_decl;
          omp_clauses = gfc_trans_add_clause (tmp, omp_clauses);
+           }
        }

Reply via email to