Workaround 'pointer used before comparison to null' code defect (pthread)
authorIvan Maidanski <ivmai@mail.ru>
Wed, 7 Dec 2016 07:40:15 +0000 (10:40 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 7 Dec 2016 07:40:15 +0000 (10:40 +0300)
(fix commit 31b3afc)

* pthread_support.c [GC_PTHREADS && !GC_WIN32_THREADS && DEBUG_THREADS]
(GC_pthread_create): Do not check new_thread is non-NULL (because
new_thread is first passed to the underlying pthread_create() where
the argument is marked with "nonnull" attribute).

pthread_support.c

index 86e6c44..8ccc3e7 100644 (file)
@@ -1822,7 +1822,7 @@ GC_API int WRAP_FUNC(pthread_create)(pthread_t *new_thread,
         IF_CANCEL(int cancel_state;)
 
 #       ifdef DEBUG_THREADS
-          if (new_thread)
+            /* new_thread is non-NULL because pthread_create requires it. */
             GC_log_printf("Started thread %p\n", (void *)(*new_thread));
 #       endif
         DISABLE_CANCEL(cancel_state);