From 5e3ef08b7265d244bb8f9597f9a2c9bc278e49e5 Mon Sep 17 00:00:00 2001 From: wlux Date: Sat, 30 Apr 2011 09:06:53 +0000 Subject: [PATCH] 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 --- ChangeLog | 6 ++++++ thr-posix.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 95b461f..756e230 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-30 Wolfgang Lux + + * 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 * GNUmakefile: When installing on Darwin/OS X create a symbolic diff --git a/thr-posix.c b/thr-posix.c index 5007d6e..eaa71cc 100644 --- a/thr-posix.c +++ b/thr-posix.c @@ -90,7 +90,7 @@ __objc_thread_detach(void (*func)(void *arg), void *arg) if (!(pthread_create(&new_thread_handle, &_objc_thread_attribs, (void *)func, arg))) - thread_id = *(objc_thread_t *)&new_thread_handle; + thread_id = (objc_thread_t)new_thread_handle; else thread_id = NULL; @@ -174,7 +174,7 @@ __objc_thread_id(void) { pthread_t self = pthread_self(); - return *(objc_thread_t *)&self; + return (objc_thread_t)self; } /* Sets the thread's local storage pointer. */