This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
PATCH: Allow non-arithmetic type for pthread_t
- From: Loren James Rittle <rittle at latour dot rsch dot comm dot mot dot com>
- To: java-patches at gcc dot gnu dot org
- Date: Tue, 19 Mar 2002 10:27:33 -0600 (CST)
- Subject: PATCH: Allow non-arithmetic type for pthread_t
- Reply-to: rittle at labs dot mot dot com
By current standard, pthread_t shall be defined as an arithmetic type
of an appropriate length. Some implementations of pthreads still use
a pointer instead of an arithmetic type and there is no good reason to
exclude them. This patch would restore bootstrap on i386-*-freebsd*
if another recently-incurred issue didn't hit.
However, I would like to observe an outright portability bug in this
code with or without my proposed patch. If sizeof (obj_addr_t) >
sizeof (pthread_t), then this code could blow up in various manners
depending upon exact architectural properties. A wide range of fixes
would be possible.
Index: posix-threads.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/posix-threads.cc,v
retrieving revision 1.31
diff -c -r1.31 posix-threads.cc
*** posix-threads.cc 2002/03/10 03:53:12 1.31
--- posix-threads.cc 2002/03/19 11:02:08
***************
*** 448,454 ****
{
pthread_t self = pthread_self();
sce -> high_sp_bits = high_sp_bits;
! release_set ((obj_addr_t *) &(sce -> self), self);
return self;
}
--- 448,454 ----
{
pthread_t self = pthread_self();
sce -> high_sp_bits = high_sp_bits;
! release_set ((obj_addr_t *) &(sce -> self), (obj_addr_t) self);
return self;
}