------- Comment #4 from fxcoudert at gcc dot gnu dot org 2008-04-21 12:54
-------
(In reply to comment #3)
> in gthr-win32.h there seems to be a more serious bug. The cast of an integer
> with less size to a pointer can be seriously wrong.
I don't think it's an issue: the type objc_thread_t, which is used as a thread
identifier, it declared as (void *), so it's larger than the integer types that
are cast into it (which are DWORD). It's inelegant, but I think it cannot cause
bugs.
I suggest silencing the warning that way (in both libobjc/thr-win32.c and
gcc/thr-win32.c):
--- thr-win32.c.old 2008-04-21 14:53:42.000000000 +0200
+++ thr-win32.c 2008-04-21 14:53:35.000000000 +0200
@@ -70,7 +70,7 @@ __objc_thread_detach(void (*func)(void *
arg, 0, &thread_id)))
thread_id = 0;
- return (objc_thread_t)thread_id;
+ return (objc_thread_t)(INT_PTR)thread_id;
}
/* Set the current thread's priority. */
@@ -151,7 +151,7 @@ __objc_thread_exit(void)
objc_thread_t
__objc_thread_id(void)
{
- return (objc_thread_t)GetCurrentThreadId();
+ return (objc_thread_t)(INT_PTR)GetCurrentThreadId();
}
/* Sets the thread's local storage pointer. */
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fxcoudert at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34315