public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgomp/42602]  New: libgomp.fortran/recursion1.f90 aborted at random
@ 2010-01-04  4:36 hjl dot tools at gmail dot com
  2010-01-04  8:02 ` [Bug libgomp/42602] " jakub at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-01-04  4:36 UTC (permalink / raw)
  To: gcc-bugs

libgomp.fortran/recursion1.f90 aborted at random on Linux/Core i7.
There are

---
implicit none
integer :: i,s

s=0
!$omp parallel do private(i) shared(s)
do i=1,10
  call sub(i)
end do
!$omp end parallel do
if (s/=55) call abort()

contains

  subroutine sub (n)
    integer :: n
    s = s + n
    print '(A,i3)',"loop =",n
  end subroutine

end
---

's' isn't always 55. It has the value of the last running thread.
Does OpenMP guarantees that 's' will be 55?


-- 
           Summary: libgomp.fortran/recursion1.f90 aborted at random
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl dot tools at gmail dot com


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


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

* [Bug libgomp/42602] libgomp.fortran/recursion1.f90 aborted at random
  2010-01-04  4:36 [Bug libgomp/42602] New: libgomp.fortran/recursion1.f90 aborted at random hjl dot tools at gmail dot com
@ 2010-01-04  8:02 ` jakub at gcc dot gnu dot org
  2010-01-04 14:22 ` hjl dot tools at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-01-04  8:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jakub at gcc dot gnu dot org  2010-01-04 08:02 -------
There is no such guarantee, the testcase contains data race.
It can increment a shared variable in multiple threads using non-atomic
instructions.  One fix would be to use
!$omp atomic
  s = s + n
instead of just
  s = s + n
Or put s = s + n into !$omp single, or use some other kind of locking.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-01-04 08:02:31
               date|                            |


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


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

* [Bug libgomp/42602] libgomp.fortran/recursion1.f90 aborted at random
  2010-01-04  4:36 [Bug libgomp/42602] New: libgomp.fortran/recursion1.f90 aborted at random hjl dot tools at gmail dot com
  2010-01-04  8:02 ` [Bug libgomp/42602] " jakub at gcc dot gnu dot org
@ 2010-01-04 14:22 ` hjl dot tools at gmail dot com
  2010-01-04 14:22 ` hjl dot tools at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-01-04 14:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hjl dot tools at gmail dot com  2010-01-04 14:22 -------
A patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2010-01/msg00141.html


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2010-
                   |                            |01/msg00141.html


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


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

* [Bug libgomp/42602] libgomp.fortran/recursion1.f90 aborted at random
  2010-01-04  4:36 [Bug libgomp/42602] New: libgomp.fortran/recursion1.f90 aborted at random hjl dot tools at gmail dot com
  2010-01-04  8:02 ` [Bug libgomp/42602] " jakub at gcc dot gnu dot org
  2010-01-04 14:22 ` hjl dot tools at gmail dot com
@ 2010-01-04 14:22 ` hjl dot tools at gmail dot com
  2010-01-04 14:28 ` [Bug libgomp/42602] [4.5 Regression] " hjl at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-01-04 14:22 UTC (permalink / raw)
  To: gcc-bugs



-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.5.0


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


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

* [Bug libgomp/42602] [4.5 Regression] libgomp.fortran/recursion1.f90 aborted at random
  2010-01-04  4:36 [Bug libgomp/42602] New: libgomp.fortran/recursion1.f90 aborted at random hjl dot tools at gmail dot com
                   ` (2 preceding siblings ...)
  2010-01-04 14:22 ` hjl dot tools at gmail dot com
@ 2010-01-04 14:28 ` hjl at gcc dot gnu dot org
  2010-01-04 18:39 ` hjl dot tools at gmail dot com
  2010-01-04 22:37 ` hjl dot tools at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: hjl at gcc dot gnu dot org @ 2010-01-04 14:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from hjl at gcc dot gnu dot org  2010-01-04 14:28 -------
Subject: Bug 42602

Author: hjl
Date: Mon Jan  4 14:28:30 2010
New Revision: 155615

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155615
Log:
Make 's' atomic

2010-01-04  H.J. Lu  <hongjiu.lu@intel.com>

        PR libgomp/42602
        * libgomp.fortran/recursion1.f90 (sub): Make 's' atomic.

Modified:
    trunk/libgomp/ChangeLog
    trunk/libgomp/testsuite/libgomp.fortran/recursion1.f90


-- 


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


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

* [Bug libgomp/42602] [4.5 Regression] libgomp.fortran/recursion1.f90 aborted at random
  2010-01-04  4:36 [Bug libgomp/42602] New: libgomp.fortran/recursion1.f90 aborted at random hjl dot tools at gmail dot com
                   ` (3 preceding siblings ...)
  2010-01-04 14:28 ` [Bug libgomp/42602] [4.5 Regression] " hjl at gcc dot gnu dot org
@ 2010-01-04 18:39 ` hjl dot tools at gmail dot com
  2010-01-04 22:37 ` hjl dot tools at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-01-04 18:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from hjl dot tools at gmail dot com  2010-01-04 18:39 -------
Now I got

At line 14 of file
/export/gnu/import/svn/gcc-test/src-trunk/libgomp/testsuite/libgomp.fortran/recursion1.f90
Fortran runtime error: Recursive call to nonrecursive procedure 'sub'


-- 


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


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

* [Bug libgomp/42602] [4.5 Regression] libgomp.fortran/recursion1.f90 aborted at random
  2010-01-04  4:36 [Bug libgomp/42602] New: libgomp.fortran/recursion1.f90 aborted at random hjl dot tools at gmail dot com
                   ` (4 preceding siblings ...)
  2010-01-04 18:39 ` hjl dot tools at gmail dot com
@ 2010-01-04 22:37 ` hjl dot tools at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-01-04 22:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from hjl dot tools at gmail dot com  2010-01-04 22:37 -------
(In reply to comment #4)
> Now I got
> 
> At line 14 of file
> /export/gnu/import/svn/gcc-test/src-trunk/libgomp/testsuite/libgomp.fortran/recursion1.f90
> Fortran runtime error: Recursive call to nonrecursive procedure 'sub'
> 

This is PR 42517. A patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2010-01/msg00187.html


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2010-01-04 22:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-04  4:36 [Bug libgomp/42602] New: libgomp.fortran/recursion1.f90 aborted at random hjl dot tools at gmail dot com
2010-01-04  8:02 ` [Bug libgomp/42602] " jakub at gcc dot gnu dot org
2010-01-04 14:22 ` hjl dot tools at gmail dot com
2010-01-04 14:22 ` hjl dot tools at gmail dot com
2010-01-04 14:28 ` [Bug libgomp/42602] [4.5 Regression] " hjl at gcc dot gnu dot org
2010-01-04 18:39 ` hjl dot tools at gmail dot com
2010-01-04 22:37 ` hjl dot tools at gmail dot com

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).