In glibc 2.1.3, I found a bug, though I am not sure. The pthread library ($GLIBC/linuxthreads)
contains pthread.c, which contains the function __pthread_find_self(). This function
seems to omit one possible control branch. Here is its definition:
myputs("__pthread_find_self : 5\n");
#else
pthread_handle h;
/* __pthread_handles[0] is the initial thread, __pthread_handles[1] is
the manager threads handled specially in thread_self(), so start at 2 */
In the above definition, the function myputs is my own printf-like function to examine
program control. One possible run that gets crashed is shown below. The reason
for crashing is the condition check in while is weak a little because there can
be (th == &__pthread_initial_thread), i.e. there is only one thread. Even if authors
know the missing branch cannot be selected by a certain reason, it would be
better to put some assertion for the branch.