[patch] Fix PR libgomp/27254
John David Anglin
dave@hiauly1.hia.nrc.ca
Wed Jun 14 01:52:00 GMT 2006
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.
Ok?
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
2006-06-13 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
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));
+#ifdef __GTHREAD_MUTEX_INIT
+ {
+ __gthread_mutex_t tmp = __GTHREAD_MUTEX_INIT;
+ iunit->lock = tmp;
+ }
+#else
+ __GTHREAD_MUTEX_INIT_FUNCTION (&iunit->lock);
+#endif
+ __gthread_mutex_lock (&iunit->lock);
iunit->recl = dtp->internal_unit_len;
More information about the Gcc-patches
mailing list