diff options
author | Jakub Jelinek <jakub@redhat.com> | 2011-08-19 15:25:22 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2011-08-19 15:25:22 +0200 |
commit | c26dffff5c573aa7f3935dddc8300a2c8fd660a1 (patch) | |
tree | 963ec6d00bf1bf89a14122150aae777bf1f6a55a /gcc/fortran/trans-expr.c | |
parent | df698a8707413cc5ebaa2f5ad0007e011eae8418 (diff) | |
download | gcc-c26dffff5c573aa7f3935dddc8300a2c8fd660a1.zip gcc-c26dffff5c573aa7f3935dddc8300a2c8fd660a1.tar.gz gcc-c26dffff5c573aa7f3935dddc8300a2c8fd660a1.tar.bz2 |
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
Diffstat (limited to 'gcc/fortran/trans-expr.c')
-rw-r--r-- | gcc/fortran/trans-expr.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 96510c2..39ad0b6 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -6137,10 +6137,6 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag, rss = NULL; if (lss != gfc_ss_terminator) { - /* Allow the scalarizer to workshare array assignments. */ - if (ompws_flags & OMPWS_WORKSHARE_FLAG) - ompws_flags |= OMPWS_SCALARIZER_WS; - /* The assignment needs scalarization. */ lss_section = lss; @@ -6196,6 +6192,10 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag, gfc_mark_ss_chain_used (loop.temp_ss, 3); } + /* Allow the scalarizer to workshare array assignments. */ + if ((ompws_flags & OMPWS_WORKSHARE_FLAG) && loop.temp_ss == NULL) + ompws_flags |= OMPWS_SCALARIZER_WS; + /* Start the scalarized loop body. */ gfc_start_scalarized_body (&loop, &body); } @@ -6304,6 +6304,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag, && !gfc_expr_attr (expr1).codimension && !gfc_is_coindexed (expr1)) { + ompws_flags &= ~OMPWS_SCALARIZER_WS; tmp = gfc_alloc_allocatable_for_assignment (&loop, expr1, expr2); if (tmp != NULL_TREE) gfc_add_expr_to_block (&loop.code[expr1->rank - 1], tmp); |