Replace dubious casts in libobjc, which can break pointer aliasing

rules and may lead to invalid code when optimization is turned on at
least on PowerPC.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/libobjc/trunk@32959 72102866-910b-0410-8b05-ffd578937521
main
wlux 15 years ago
parent 72cc82bf10
commit 5e3ef08b72

@ -1,3 +1,9 @@
2011-04-30 Wolfgang Lux <wolfgang.lux@gmail.com>
* thr-posix.c (__objc_thread_detach, __objc_thread_id): Replace
dubious casts, which can break pointer aliasing rules and may lead
to invalid code when optimization is turned on at least on PowerPC.
2011-04-30 Wolfgang Lux <wolfgang.lux@gmail.com> 2011-04-30 Wolfgang Lux <wolfgang.lux@gmail.com>
* GNUmakefile: When installing on Darwin/OS X create a symbolic * GNUmakefile: When installing on Darwin/OS X create a symbolic

@ -90,7 +90,7 @@ __objc_thread_detach(void (*func)(void *arg), void *arg)
if (!(pthread_create(&new_thread_handle, &_objc_thread_attribs, if (!(pthread_create(&new_thread_handle, &_objc_thread_attribs,
(void *)func, arg))) (void *)func, arg)))
thread_id = *(objc_thread_t *)&new_thread_handle; thread_id = (objc_thread_t)new_thread_handle;
else else
thread_id = NULL; thread_id = NULL;
@ -174,7 +174,7 @@ __objc_thread_id(void)
{ {
pthread_t self = pthread_self(); pthread_t self = pthread_self();
return *(objc_thread_t *)&self; return (objc_thread_t)self;
} }
/* Sets the thread's local storage pointer. */ /* Sets the thread's local storage pointer. */

Loading…
Cancel
Save