From c26dffff5c573aa7f3935dddc8300a2c8fd660a1 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 19 Aug 2011 15:25:22 +0200 Subject: re PR fortran/49792 (OpenMP workshare: Wrong result with array assignment) PR fortran/49792 * trans-expr.c (gfc_trans_assignment_1): Set OMPWS_SCALARIZER_WS bit in ompws_flags only if loop.temp_ss is NULL, and clear it if lhs needs reallocation. * trans-openmp.c (gfc_trans_omp_workshare): Don't return early if code is NULL, emit a barrier if workshare emitted no code at all and NOWAIT clause isn't present. * testsuite/libgomp.fortran/pr49792-1.f90: New test. * testsuite/libgomp.fortran/pr49792-2.f90: New test. From-SVN: r177898 --- gcc/fortran/trans-openmp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/fortran/trans-openmp.c') diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index b1f8e09..cfe8612 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -1764,9 +1764,6 @@ gfc_trans_omp_workshare (gfc_code *code, gfc_omp_clauses *clauses) pushlevel (0); - if (!code) - return build_empty_stmt (input_location); - gfc_start_block (&block); pblock = █ @@ -1903,6 +1900,9 @@ gfc_trans_omp_workshare (gfc_code *code, gfc_omp_clauses *clauses) else poplevel (0, 0, 0); + if (IS_EMPTY_STMT (stmt) && !clauses->nowait) + stmt = gfc_trans_omp_barrier (); + ompws_flags = 0; return stmt; } -- cgit v1.1