This is the mail archive of the 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] Fix PR libgomp/27254

The enclosed patch fixes PR libgomp/27254.  On PA-RISC, locks need to
be explicitly initialized or they won't work.  Carlos O'Donnell noticed
in discussing this PR that we weren't initializing the locks used for
internal units.  As a result, when the code tries to unlock the lock,
it appears to be locked but never in fact gets unlocked by any thread.
This results in the test spinning forever.

The enclosed change provides an initialized and locked lock for internal
units.  I believe that locking the lock provides the correct semantics
as per the description in unit.c.

The change has been tested on the trunk on hppa-unknown-linux-gnu with
no regressions.


J. David Anglin                        
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2006-06-13  John David Anglin  <>

	PR libgomp/27254
	* io/unit.c (get_internal_unit): Initialize and lock thread mutex
	for internal units.

Index: io/unit.c
--- io/unit.c	(revision 114624)
+++ io/unit.c	(working copy)
@@ -376,6 +376,15 @@
   memset (iunit, '\0', sizeof (gfc_unit));
+  {
+    __gthread_mutex_t tmp = __GTHREAD_MUTEX_INIT;
+    iunit->lock = tmp;
+  }
+  __GTHREAD_MUTEX_INIT_FUNCTION (&iunit->lock);
+  __gthread_mutex_lock (&iunit->lock);
   iunit->recl = dtp->internal_unit_len;

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