public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/49792] New: OpenMP workshare: Wrong result with array assignment
@ 2011-07-20  9:50 burnus at gcc dot gnu.org
  2011-08-19 13:27 ` [Bug fortran/49792] " jakub at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-07-20  9:50 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49792

           Summary: OpenMP workshare: Wrong result with array assignment
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: openmp, wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: pkeir@dcs.gla.ac.uk


Based on the thread at http://gcc.gnu.org/ml/fortran/2011-07/msg00194.html

OpenMP 3.1 has in "2.5.4 workshare Construct" (normative text):

"An implementation of the workshare construct must insert any synchronization
that is required to maintain standard Fortran semantics. For example, the
effects of one statement within the structured block must appear to occur
before the execution of succeeding statements, and the evaluation of the right
hand side of an assignment must appear to complete prior to the effects of
assigning to the left hand side."


That seems to fail for:

!$omp parallel workshare
    a(:) = a(n:1:-1)
!$omp end parallel workshare

which cannot be run in parallel as the element access on the RHS cannot be done
in arbitrary order.

Possible solution: Make use of gfortran's dependency.c machinery but only look
for GFC_DEP_EQUAL and GFC_DEP_NODEP - and ignore, e.g., GFC_DEP_BACKWARD or
GFC_DEP_FORWARD, which indicate that the loop order is important.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/49792] OpenMP workshare: Wrong result with array assignment
  2011-07-20  9:50 [Bug fortran/49792] New: OpenMP workshare: Wrong result with array assignment burnus at gcc dot gnu.org
@ 2011-08-19 13:27 ` jakub at gcc dot gnu.org
  2011-08-19 13:32 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-08-19 13:27 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49792

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-08-19 13:25:26 UTC ---
Author: jakub
Date: Fri Aug 19 13:25:22 2011
New Revision: 177898

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=177898
Log:
    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.

Added:
    trunk/libgomp/testsuite/libgomp.fortran/pr49792-1.f90
    trunk/libgomp/testsuite/libgomp.fortran/pr49792-2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/fortran/trans-openmp.c
    trunk/libgomp/ChangeLog


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/49792] OpenMP workshare: Wrong result with array assignment
  2011-07-20  9:50 [Bug fortran/49792] New: OpenMP workshare: Wrong result with array assignment burnus at gcc dot gnu.org
  2011-08-19 13:27 ` [Bug fortran/49792] " jakub at gcc dot gnu.org
@ 2011-08-19 13:32 ` jakub at gcc dot gnu.org
  2011-08-19 13:37 ` jakub at gcc dot gnu.org
  2015-10-29 14:47 ` dominiq at lps dot ens.fr
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-08-19 13:32 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49792

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-08-19 13:26:54 UTC ---
Author: jakub
Date: Fri Aug 19 13:26:50 2011
New Revision: 177900

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=177900
Log:
    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.

Added:
    branches/gcc-4_6-branch/libgomp/testsuite/libgomp.fortran/pr49792-1.f90
    branches/gcc-4_6-branch/libgomp/testsuite/libgomp.fortran/pr49792-2.f90
Modified:
    branches/gcc-4_6-branch/gcc/fortran/ChangeLog
    branches/gcc-4_6-branch/gcc/fortran/trans-expr.c
    branches/gcc-4_6-branch/gcc/fortran/trans-openmp.c
    branches/gcc-4_6-branch/libgomp/ChangeLog


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/49792] OpenMP workshare: Wrong result with array assignment
  2011-07-20  9:50 [Bug fortran/49792] New: OpenMP workshare: Wrong result with array assignment burnus at gcc dot gnu.org
  2011-08-19 13:27 ` [Bug fortran/49792] " jakub at gcc dot gnu.org
  2011-08-19 13:32 ` jakub at gcc dot gnu.org
@ 2011-08-19 13:37 ` jakub at gcc dot gnu.org
  2015-10-29 14:47 ` dominiq at lps dot ens.fr
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-08-19 13:37 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49792

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011-08-19
                 CC|                            |jakub at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |jakub at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-08-19 13:35:46 UTC ---
Fixed for 4.6+ so far.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/49792] OpenMP workshare: Wrong result with array assignment
  2011-07-20  9:50 [Bug fortran/49792] New: OpenMP workshare: Wrong result with array assignment burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-08-19 13:37 ` jakub at gcc dot gnu.org
@ 2015-10-29 14:47 ` dominiq at lps dot ens.fr
  3 siblings, 0 replies; 5+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-10-29 14:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Fixed for 4.6+ so far.

Any reason why this PR is not closed as FIXED?


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-29 14:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-20  9:50 [Bug fortran/49792] New: OpenMP workshare: Wrong result with array assignment burnus at gcc dot gnu.org
2011-08-19 13:27 ` [Bug fortran/49792] " jakub at gcc dot gnu.org
2011-08-19 13:32 ` jakub at gcc dot gnu.org
2011-08-19 13:37 ` jakub at gcc dot gnu.org
2015-10-29 14:47 ` dominiq at lps dot ens.fr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).