This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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] Fix __ctype_b_loc aliasing violation


Hi!

On Thu, Nov 06, 2008 at 12:27:17AM -0800, Adam Nemet wrote:
> The locale tests are failing on mips64octeon-linux-gnu (with config.sub from
> GCC) because *__ctype_b_loc () can yield NULL.
> 
> The reason I believe is an aliasing violation in the implementation:
> 
>      1	CTYPE_EXTERN_INLINE const uint16_t ** __attribute__ ((const))
>      2	__ctype_b_loc (void)
>      3	{
>      4	  union
>      5	    {
>      6	      void **ptr;
>      7	      const uint16_t **tablep;
>      8	    } u;
>      9	  u.ptr = __libc_tsd_address (CTYPE_B);
>     10	  if (__builtin_expect (*u.tablep == NULL, 0))
>     11	    *u.tablep = (const uint16_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_CLASS) + 128;
>     12	  return u.tablep;
>     13	}

Yeah, indeed.  I can reproduce it, a lot of stuff segfaults in glibc
compiled with current GCC trunk on x86_64-linux, starting with localedef.

Going through a union is just a workaround for a warning, not real
fix and indeed this aliasing violation finally caught us.

Here is a fix, tested with gcc 4.4.  Guess it would be good if somebody
tested it on Hurd as well.

2008-11-07  Jakub Jelinek  <jakub@redhat.com>

	* bits/libc-tsd.h (__libc_tsd_define, __libc_tsd_address,
	__libc_tsd_get, __libc_tsd_set): Add TYPE argument, use it as the type
	of the thread variable instead of void *.
	* sysdeps/mach/hurd/bits/libc-tsd.h (__libc_tsd_define,
	__libc_tsd_address, __libc_tsd_get, __libc_tsd_set): Likewise.
	* include/ctype.h (CTYPE_B, CTYPE_TOUPPER, CTYPE_TOLOWER): Adjust
	__libc_tsd_define arguments.
	(__ctype_b_loc, __ctype_toupper_loc, __ctype_tolower_loc): Adjust
	__libc_tsd_address arguments.  Remove union hack.
	* include/rpc/rpc.h (RPC_VARS): Adjust __libc_tsd_define arguments.
	* sunrpc/rpc_thread.c (RPC_VARS): Likewise.
	(__rpc_thread_destroy, rpc_thread_multi, __rpc_thread_variables):
	Adjust __libc_tsd_{set,get} arguments.
	* ctype/ctype-info.c (CTYPE_B, CTYPE_TOUPPER, CTYPE_TOLOWER): Adjust
	__libc_tsd_define arguments.
	* locale/uselocale.c (__uselocale): Adjust __libc_tsd_{set,get}
	arguments.
	* locale/lc-ctype.c (_nl_postload_ctype): Likewise.
	* locale/global-locale.c (__libc_tsd_LOCALE): Adjust type.
	(LOCALE): Adjust __libc_tsd_define arguments.
	* locale/localeinfo.h (_NL_CURRENT_LOCALE): Adjust __libc_tsd_get
	arguments.
	(LOCALE): Adjust __libc_tsd_define arguments.
	* sysdeps/mach/hurd/malloc-machine.h (MALLOC): Adjust __libc_tsd_define
	arguments.
	(tsd_setspecific, tsd_getspecific): Adjust __libc_tsd_{set,get}
	arguments.
nptl/ 
	* sysdeps/pthread/malloc-machine.h (MALLOC): Adjust __libc_tsd_define
	arguments.
	(tsd_setspecific, tsd_getspecific): Adjust __libc_tsd_{set,get}
	arguments.

--- libc/bits/libc-tsd.h.jj	2002-10-16 00:50:42.000000000 +0200
+++ libc/bits/libc-tsd.h	2008-11-07 11:22:16.000000000 +0100
@@ -1,5 +1,5 @@
 /* libc-internal interface for thread-specific data.  Stub or TLS version.
-   Copyright (C) 1998,2001,02 Free Software Foundation, Inc.
+   Copyright (C) 1998,2001,2002,2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -23,15 +23,15 @@
 /* This file defines the following macros for accessing a small fixed
    set of thread-specific `void *' data used only internally by libc.
 
-   __libc_tsd_define(CLASS, KEY)	-- Define or declare a `void *' datum
+   __libc_tsd_define(CLASS, TYPE, KEY)	-- Define or declare a datum with TYPE
    					   for KEY.  CLASS can be `static' for
 					   keys used in only one source file,
 					   empty for global definitions, or
 					   `extern' for global declarations.
-   __libc_tsd_address(KEY)		-- Return the `void **' pointing to
+   __libc_tsd_address(TYPE, KEY)	-- Return the `TYPE *' pointing to
    					   the current thread's datum for KEY.
-   __libc_tsd_get(KEY)			-- Return the `void *' datum for KEY.
-   __libc_tsd_set(KEY, VALUE)		-- Set the datum for KEY to VALUE.
+   __libc_tsd_get(TYPE, KEY)		-- Return the `TYPE' datum for KEY.
+   __libc_tsd_set(TYPE, KEY, VALUE)	-- Set the datum for KEY to VALUE.
 
    The set of available KEY's will usually be provided as an enum,
    and contains (at least):
@@ -52,18 +52,19 @@
    translate directly into variables by macro magic.  */
 
 #if USE___THREAD
-# define __libc_tsd_define(CLASS, KEY)	\
-  CLASS __thread void *__libc_tsd_##KEY attribute_tls_model_ie;
+# define __libc_tsd_define(CLASS, TYPE, KEY)	\
+  CLASS __thread TYPE __libc_tsd_##KEY attribute_tls_model_ie;
 
-# define __libc_tsd_address(KEY)	(&__libc_tsd_##KEY)
-# define __libc_tsd_get(KEY)		(__libc_tsd_##KEY)
-# define __libc_tsd_set(KEY, VALUE)	(__libc_tsd_##KEY = (VALUE))
+# define __libc_tsd_address(TYPE, KEY)		(&__libc_tsd_##KEY)
+# define __libc_tsd_get(TYPE, KEY)		(__libc_tsd_##KEY)
+# define __libc_tsd_set(TYPE, KEY, VALUE)	(__libc_tsd_##KEY = (VALUE))
 #else
-# define __libc_tsd_define(CLASS, KEY)	CLASS void *__libc_tsd_##KEY##_data;
+# define __libc_tsd_define(CLASS, TYPE, KEY)	\
+  CLASS TYPE __libc_tsd_##KEY##_data;
 
-# define __libc_tsd_address(KEY)	(&__libc_tsd_##KEY##_data)
-# define __libc_tsd_get(KEY)		(__libc_tsd_##KEY##_data)
-# define __libc_tsd_set(KEY, VALUE)	(__libc_tsd_##KEY##_data = (VALUE))
+# define __libc_tsd_address(TYPE, KEY)		(&__libc_tsd_##KEY##_data)
+# define __libc_tsd_get(TYPE, KEY)		(__libc_tsd_##KEY##_data)
+# define __libc_tsd_set(TYPE, KEY, VALUE)	(__libc_tsd_##KEY##_data = (VALUE))
 #endif
 
 #endif	/* bits/libc-tsd.h */
--- libc/sysdeps/mach/hurd/bits/libc-tsd.h.jj	2002-09-02 09:08:51.000000000 +0200
+++ libc/sysdeps/mach/hurd/bits/libc-tsd.h	2008-11-07 11:23:46.000000000 +0100
@@ -1,5 +1,5 @@
 /* libc-internal interface for thread-specific data.  Hurd version.
-   Copyright (C) 1998,2002 Free Software Foundation, Inc.
+   Copyright (C) 1998,2002,2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -22,13 +22,14 @@
 
 #include <hurd/threadvar.h>
 
-#define __libc_tsd_define(CLASS, KEY) /* nothing, always have threadvars */
+#define __libc_tsd_define(TYPE, CLASS, KEY) /* nothing, always have threadvars */
 
-#define __libc_tsd_address(KEY) \
-  ((void **) __hurd_threadvar_location (_HURD_THREADVAR_##KEY))
-
-#define __libc_tsd_get(KEY)		(*__libc_tsd_address (KEY))
-#define __libc_tsd_set(KEY, VALUE)	(*__libc_tsd_address (KEY) = (VALUE))
+#define __libc_tsd_address(TYPE, KEY) \
+  ((TYPE *) __hurd_threadvar_location (_HURD_THREADVAR_##KEY))
 
+#define __libc_tsd_get(TYPE, KEY) \
+  (*__libc_tsd_address (TYPE, KEY))
+#define __libc_tsd_set(TYPE, KEY, VALUE) \
+  (*__libc_tsd_address (TYPE, KEY) = (VALUE))
 
 #endif	/* bits/libc-tsd.h */
--- libc/include/ctype.h.jj	2004-03-16 11:09:04.000000000 +0100
+++ libc/include/ctype.h	2008-11-07 11:35:26.000000000 +0100
@@ -18,50 +18,35 @@ extern int __isctype (int __c, int __mas
 #   define CTYPE_EXTERN_INLINE extern inline
 #  endif
 
-__libc_tsd_define (extern, CTYPE_B)
-__libc_tsd_define (extern, CTYPE_TOUPPER)
-__libc_tsd_define (extern, CTYPE_TOLOWER)
+__libc_tsd_define (extern, const uint16_t *, CTYPE_B)
+__libc_tsd_define (extern, const int32_t *, CTYPE_TOUPPER)
+__libc_tsd_define (extern, const int32_t *, CTYPE_TOLOWER)
 
 CTYPE_EXTERN_INLINE const uint16_t ** __attribute__ ((const))
 __ctype_b_loc (void)
 {
-  union
-    {
-      void **ptr;
-      const uint16_t **tablep;
-    } u;
-  u.ptr = __libc_tsd_address (CTYPE_B);
-  if (__builtin_expect (*u.tablep == NULL, 0))
-    *u.tablep = (const uint16_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_CLASS) + 128;
-  return u.tablep;
+  const uint16_t **tablep = __libc_tsd_address (const uint16_t *, CTYPE_B);
+  if (__builtin_expect (*tablep == NULL, 0))
+    *tablep = (const uint16_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_CLASS) + 128;
+  return tablep;
 }
 
 CTYPE_EXTERN_INLINE const int32_t ** __attribute__ ((const))
 __ctype_toupper_loc (void)
 {
-  union
-    {
-      void **ptr;
-      const int32_t **tablep;
-    } u;
-  u.ptr = __libc_tsd_address (CTYPE_TOUPPER);
-  if (__builtin_expect (*u.tablep == NULL, 0))
-    *u.tablep = ((int32_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_TOUPPER) + 128);
-  return u.tablep;
+  const int32_t **tablep = __libc_tsd_address (const int32_t *, CTYPE_TOUPPER);
+  if (__builtin_expect (*tablep == NULL, 0))
+    *tablep = ((int32_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_TOUPPER) + 128);
+  return tablep;
 }
 
 CTYPE_EXTERN_INLINE const int32_t ** __attribute__ ((const))
 __ctype_tolower_loc (void)
 {
-  union
-    {
-      void **ptr;
-      const int32_t **tablep;
-    } u;
-  u.ptr = __libc_tsd_address (CTYPE_TOLOWER);
-  if (__builtin_expect (*u.tablep == NULL, 0))
-    *u.tablep = ((int32_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_TOLOWER) + 128);
-  return u.tablep;
+  const int32_t **tablep = __libc_tsd_address (const int32_t *, CTYPE_TOLOWER);
+  if (__builtin_expect (*tablep == NULL, 0))
+    *tablep = ((int32_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_TOLOWER) + 128);
+  return tablep;
 }
 
 # endif	/* Not NOT_IN_libc.  */
--- libc/include/rpc/rpc.h.jj	2004-02-09 11:47:53.000000000 +0100
+++ libc/include/rpc/rpc.h	2008-11-07 11:30:56.000000000 +0100
@@ -45,7 +45,7 @@ extern void __rpc_thread_key_cleanup (vo
 
 extern void __rpc_thread_destroy (void);
 
-__libc_tsd_define (extern, RPC_VARS)
+__libc_tsd_define (extern, struct rpc_thread_variables *, RPC_VARS)
 
 #define RPC_THREAD_VARIABLE(x) (__rpc_thread_variables()->x)
 
--- libc/sunrpc/rpc_thread.c.jj	2008-02-01 10:54:30.000000000 +0100
+++ libc/sunrpc/rpc_thread.c	2008-11-07 11:32:42.000000000 +0100
@@ -10,7 +10,7 @@
 
 /* Variable used in non-threaded applications or for the first thread.  */
 static struct rpc_thread_variables __libc_tsd_RPC_VARS_mem;
-__libc_tsd_define (, RPC_VARS)
+__libc_tsd_define (, struct rpc_thread_variables *, RPC_VARS)
 
 /*
  * Task-variable destructor
@@ -18,7 +18,8 @@ __libc_tsd_define (, RPC_VARS)
 void __attribute__ ((section ("__libc_thread_freeres_fn")))
 __rpc_thread_destroy (void)
 {
-	struct rpc_thread_variables *tvp = __libc_tsd_get (RPC_VARS);
+	struct rpc_thread_variables *tvp
+	  = __libc_tsd_get (struct rpc_thread_variables *, RPC_VARS);
 
 	if (tvp != NULL) {
 		__rpc_thread_svc_cleanup ();
@@ -33,7 +34,7 @@ __rpc_thread_destroy (void)
 		free (tvp->svc_pollfd_s);
 		if (tvp != &__libc_tsd_RPC_VARS_mem)
 			free (tvp);
-		__libc_tsd_set (RPC_VARS, NULL);
+		__libc_tsd_set (struct rpc_thread_variables *, RPC_VARS, NULL);
 	}
 }
 #ifdef _LIBC_REENTRANT
@@ -48,7 +49,8 @@ text_set_element (__libc_subfreeres, __r
 static void
 rpc_thread_multi (void)
 {
-  __libc_tsd_set (RPC_VARS, &__libc_tsd_RPC_VARS_mem);
+  __libc_tsd_set (struct rpc_thread_variables *, RPC_VARS,
+		  &__libc_tsd_RPC_VARS_mem);
 }
 
 
@@ -58,16 +60,18 @@ __rpc_thread_variables (void)
 	__libc_once_define (static, once);
 	struct rpc_thread_variables *tvp;
 
-	tvp = __libc_tsd_get (RPC_VARS);
+	tvp = __libc_tsd_get (struct rpc_thread_variables *, RPC_VARS);
 	if (tvp == NULL) {
 		__libc_once (once, rpc_thread_multi);
-		tvp = __libc_tsd_get (RPC_VARS);
+		tvp = __libc_tsd_get (struct rpc_thread_variables *, RPC_VARS);
 		if (tvp == NULL) {
 			tvp = calloc (1, sizeof *tvp);
 			if (tvp != NULL)
-				__libc_tsd_set (RPC_VARS, tvp);
+				__libc_tsd_set (struct rpc_thread_variables *,
+						RPC_VARS, tvp);
 			else
-				tvp = __libc_tsd_get (RPC_VARS);
+				tvp = __libc_tsd_get (struct rpc_thread_variables *,
+						      RPC_VARS);
 		}
 	}
 	return tvp;
--- libc/ctype/ctype-info.c.jj	2002-09-05 23:21:48.000000000 +0200
+++ libc/ctype/ctype-info.c	2008-11-07 11:36:34.000000000 +0100
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,92,95,96,97,99,2000,02 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,95,96,97,99,2000, 2002, 2008
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -20,9 +21,9 @@
 #include <ctype.h>
 #include <locale/localeinfo.h>
 
-__libc_tsd_define (, CTYPE_B)
-__libc_tsd_define (, CTYPE_TOLOWER)
-__libc_tsd_define (, CTYPE_TOUPPER)
+__libc_tsd_define (const uint16_t *, CTYPE_B)
+__libc_tsd_define (const int32_t *, CTYPE_TOLOWER)
+__libc_tsd_define (const int32_t *, CTYPE_TOUPPER)
 
 
 #include <shlib-compat.h>
--- libc/nptl/sysdeps/pthread/malloc-machine.h.jj	2007-12-10 09:05:33.000000000 +0100
+++ libc/nptl/sysdeps/pthread/malloc-machine.h	2008-11-07 11:39:11.000000000 +0100
@@ -1,6 +1,6 @@
 /* Basic platform-independent macro definitions for mutexes,
    thread-specific data and parameters for malloc.
-   Copyright (C) 2003, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -63,10 +63,10 @@ extern void *__dso_handle __attribute__ 
 #include <bits/libc-tsd.h>
 
 typedef int tsd_key_t[1];	/* no key data structure, libc magic does it */
-__libc_tsd_define (static, MALLOC)	/* declaration/common definition */
+__libc_tsd_define (static, void *, MALLOC)	/* declaration/common definition */
 #define tsd_key_create(key, destr)	((void) (key))
-#define tsd_setspecific(key, data)	__libc_tsd_set (MALLOC, (data))
-#define tsd_getspecific(key, vptr)	((vptr) = __libc_tsd_get (MALLOC))
+#define tsd_setspecific(key, data)	__libc_tsd_set (void *, MALLOC, (data))
+#define tsd_getspecific(key, vptr)	((vptr) = __libc_tsd_get (void *, MALLOC))
 
 #include <sysdeps/generic/malloc-machine.h>
 
--- libc/locale/uselocale.c.jj	2007-02-26 18:13:44.000000000 +0100
+++ libc/locale/uselocale.c	2008-11-07 11:42:47.000000000 +0100
@@ -1,5 +1,5 @@
 /* uselocale -- fetch and set the current per-thread locale
-   Copyright (C) 2002, 2004, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -35,7 +35,7 @@ __uselocale (locale_t newloc)
     {
       const locale_t locobj
 	= newloc == LC_GLOBAL_LOCALE ? &_nl_global_locale : newloc;
-      __libc_tsd_set (LOCALE, locobj);
+      __libc_tsd_set (__locale_t, LOCALE, locobj);
 
 #ifdef NL_CURRENT_INDIRECT
       /* Now we must update all the per-category thread-local variables to
@@ -63,9 +63,11 @@ __uselocale (locale_t newloc)
 #endif
 
       /* Update the special tsd cache of some locale data.  */
-      __libc_tsd_set (CTYPE_B, (void *) locobj->__ctype_b);
-      __libc_tsd_set (CTYPE_TOLOWER, (void *) locobj->__ctype_tolower);
-      __libc_tsd_set (CTYPE_TOUPPER, (void *) locobj->__ctype_toupper);
+      __libc_tsd_set (const uint16_t *, CTYPE_B, (void *) locobj->__ctype_b);
+      __libc_tsd_set (const int32_t *, CTYPE_TOLOWER,
+		      (void *) locobj->__ctype_tolower);
+      __libc_tsd_set (const int32_t *, CTYPE_TOUPPER,
+		      (void *) locobj->__ctype_toupper);
     }
 
   return oldloc == &_nl_global_locale ? LC_GLOBAL_LOCALE : oldloc;
--- libc/locale/lc-ctype.c.jj	2005-02-17 02:16:08.000000000 +0100
+++ libc/locale/lc-ctype.c	2008-11-07 11:43:37.000000000 +0100
@@ -1,5 +1,5 @@
 /* Define current locale data for LC_CTYPE category.
-   Copyright (C) 1995,1996,1997,1998,1999,2000,2002,2003,2005
+   Copyright (C) 1995,1996,1997,1998,1999,2000,2002,2003,2005,2008
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -66,10 +66,11 @@ _nl_postload_ctype (void)
      in fact using the global locale.  */
   if (_NL_CURRENT_LOCALE == &_nl_global_locale)
     {
-      __libc_tsd_set (CTYPE_B, (void *) _nl_global_locale.__ctype_b);
-      __libc_tsd_set (CTYPE_TOUPPER,
+      __libc_tsd_set (const uint16_t *, CTYPE_B,
+		      (void *) _nl_global_locale.__ctype_b);
+      __libc_tsd_set (const int32_t *, CTYPE_TOUPPER,
 		      (void *) _nl_global_locale.__ctype_toupper);
-      __libc_tsd_set (CTYPE_TOLOWER,
+      __libc_tsd_set (const int32_t *, CTYPE_TOLOWER,
 		      (void *) _nl_global_locale.__ctype_tolower);
     }
 
--- libc/locale/global-locale.c.jj	2006-10-31 23:05:31.000000000 +0100
+++ libc/locale/global-locale.c	2008-11-07 11:46:41.000000000 +0100
@@ -1,5 +1,5 @@
 /* Locale object representing the global locale controlled by setlocale.
-   Copyright (C) 2002, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2006, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -62,9 +62,9 @@ struct __locale_struct _nl_global_locale
 #include <tls.h>
 #if HAVE___THREAD
 /* The tsd macros don't permit an initializer.  */
-__thread void *__libc_tsd_LOCALE = &_nl_global_locale;
+__thread __locale_t __libc_tsd_LOCALE = &_nl_global_locale;
 #else
-__libc_tsd_define (, LOCALE)
+__libc_tsd_define (, __locale_t, LOCALE)
 /* This is a bad kludge presuming the variable name used by the macros.
    Using typeof makes sure to barf if we do not match the macro definition.
    This ifndef is a further bad kludge for Hurd, where there is an explicit
--- libc/locale/localeinfo.h.jj	2007-08-27 14:17:19.000000000 +0200
+++ libc/locale/localeinfo.h	2008-11-07 11:46:01.000000000 +0100
@@ -1,5 +1,6 @@
 /* Declarations for internal libc locale interfaces
-   Copyright (C) 1995-2003, 2005, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1995-2003, 2005, 2006, 2007, 2008
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -203,9 +204,9 @@ extern struct __locale_struct _nl_global
 
 /* This fetches the thread-local locale_t pointer, either one set with
    uselocale or &_nl_global_locale.  */
-#define _NL_CURRENT_LOCALE	((__locale_t) __libc_tsd_get (LOCALE))
+#define _NL_CURRENT_LOCALE	(__libc_tsd_get (__locale_t, LOCALE))
 #include <bits/libc-tsd.h>
-__libc_tsd_define (extern, LOCALE)
+__libc_tsd_define (extern, __locale_t, LOCALE)
 
 
 /* For static linking it is desireable to avoid always linking in the code
--- libc/sysdeps/mach/hurd/malloc-machine.h.jj	2008-11-07 11:51:25.000000000 +0100
+++ libc/sysdeps/mach/hurd/malloc-machine.h	2008-11-07 11:51:50.000000000 +0100
@@ -1,6 +1,6 @@
 /* Basic platform-independent macro definitions for mutexes,
    thread-specific data and parameters for malloc.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -58,10 +58,10 @@
 #include <bits/libc-tsd.h>
 
 typedef int tsd_key_t[1];	/* no key data structure, libc magic does it */
-__libc_tsd_define (static, MALLOC)	/* declaration/common definition */
+__libc_tsd_define (static, void *, MALLOC)	/* declaration/common definition */
 #define tsd_key_create(key, destr)	((void) (key))
-#define tsd_setspecific(key, data)	__libc_tsd_set (MALLOC, (data))
-#define tsd_getspecific(key, vptr)	((vptr) = __libc_tsd_get (MALLOC))
+#define tsd_setspecific(key, data)	__libc_tsd_set (void *, MALLOC, (data))
+#define tsd_getspecific(key, vptr)	((vptr) = __libc_tsd_get (void *, MALLOC))
 
 #include <sysdeps/generic/malloc-machine.h>
 

	Jakub


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