This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: PR libgomp/42602: libgomp.fortran/recursion1.f90 aborted at random


Hi,

The shared variable 's' is updated by multiple thread. This patch
makes it atomic.  OK for trunk?

Thanks.


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

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

diff --git a/libgomp/testsuite/libgomp.fortran/recursion1.f90 b/libgomp/testsuite/libgomp.fortran/recursion1.f90
index 0b7b271..35cb878 100644
--- a/libgomp/testsuite/libgomp.fortran/recursion1.f90
+++ b/libgomp/testsuite/libgomp.fortran/recursion1.f90
@@ -20,6 +20,7 @@ contains
 
   subroutine sub (n)
     integer :: n
+!$omp atomic
     s = s + n
     print '(A,i3)',"loop =",n
   end subroutine


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]