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]

Patch: Re: objc FAILs under hpux/-threads with gcc-2.96 CVS 20000816


> 		=== objc Summary for unix/-threads ===
> 
> # of expected passes		22
> # of unexpected failures	22

The enclosed patch corrects the problem.  There are now no objc failures
under hpux 10.20.  The patch code is similar to that used for posix
threads.

The file libobjc/thr-dce.c contains a similar set of functions as gthr-dce.h.
The code therein incorrectly passes `&(mutex->backend)'.  I didn't fix
thr-dce.c since it doesn't appear to be used anymore.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2000-08-31  J. David Anglin  <dave@hiauly1.hia.nrc.ca>

	* gthr-dce.h (__gthread_objc_mutex_allocate): Create a pthread_mutex_t
	object before calling pthread_mutex_init.

--- gthr-dce.h.orig	Fri Aug  4 13:25:19 2000
+++ gthr-dce.h	Thu Aug 31 14:10:37 2000
@@ -274,10 +274,18 @@
 static inline int
 __gthread_objc_mutex_allocate(objc_mutex_t mutex)
 {
-  if (__gthread_active_p ()
-      && pthread_mutex_init((pthread_mutex_t *)mutex->backend,
+  if (__gthread_active_p ())
+    {
+      mutex->backend = objc_malloc(sizeof(pthread_mutex_t));
+
+      if (pthread_mutex_init((pthread_mutex_t *)mutex->backend,
       			    pthread_mutexattr_default))
-    return -1;
+        {
+          objc_free(mutex->backend);
+          mutex->backend = NULL;
+          return -1;
+        }
+    }
 
   return 0;
 }

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