This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java 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: Allow non-arithmetic type for pthread_t


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;
  }
  


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