* tests/test.c (GC_OPT_INIT): Do not define to GC_INIT() even if
THREAD_LOCAL_ALLOC; force define to GC_INIT() if TEST_EXPLICIT_GC_INIT
macro defined.
* thread_local_alloc.c [USE_PTHREAD_SPECIFIC || USE_WIN32_SPECIFIC]
(GC_malloc_kind): Check keys_initialized before GC_getspecific call
(fall back to GC_malloc_kind_global if keys_initialized is false).
/* Call GC_INIT only on platforms on which we think we really need it, */
/* so that we can test automatic initialization on the rest. */
-#if defined(CYGWIN32) || defined (AIX) || defined(DARWIN) \
- || defined(PLATFORM_ANDROID) || defined(THREAD_LOCAL_ALLOC) \
+#if defined(TEST_EXPLICIT_GC_INIT) || defined(AIX) || defined(CYGWIN32) \
+ || defined(DARWIN) || defined(PLATFORM_ANDROID) \
|| (defined(MSWINCE) && !defined(GC_WINMAIN_REDIRECT))
# define GC_OPT_INIT GC_INIT()
#else
tsd = GC_getspecific(k);
}
# else
+ if (!EXPECT(keys_initialized, TRUE))
+ return GC_malloc_kind_global(bytes, knd);
tsd = GC_getspecific(GC_thread_key);
# endif
# if !defined(USE_COMPILER_TLS) && !defined(USE_WIN32_COMPILER_TLS)