From mboxrd@z Thu Jan 1 00:00:00 1970 From: "John David Anglin" To: dave@hiauly1.hia.nrc.ca (John David Anglin) Cc: gcc-bugs@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Patch: Re: objc FAILs under hpux/-threads with gcc-2.96 CVS 20000816 Date: Fri, 01 Sep 2000 13:29:00 -0000 Message-id: <200009012029.QAA17144@hiauly1.hia.nrc.ca> References: X-SW-Source: 2000-09/msg00019.html > === 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 * 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; }