Hi all,

I've just filed a bug on glibc I'd love you to take a look at:
https://sourceware.org/bugzilla/show_bug.cgi?id=16796

Here's the description to save clicking:

Hi,

There is a test in glibc (tst-tls5) that tests that
((uintptr_t)pthread_self())%16 is zero.  But watch this:

(t-mwhudson)mwhudson@am1:~$ cat btp.c 
#include <stdint.h>
#include <stdio.h>
#include <pthread.h>

int
main(int argc, char** argv)
{
        uintptr_t p = (uintptr_t)__builtin_thread_pointer();
        uintptr_t q = (uintptr_t)pthread_self();
        printf("p: %lx %ld\n", p, p%16);
        printf("q: %lx %ld\n", q, q%16);
}
(t-mwhudson)mwhudson@am1:~$ gcc -o btp btp.c -lpthread
(t-mwhudson)mwhudson@am1:~$ ulimit -s unlimited
(t-mwhudson)mwhudson@am1:~$ ./btp
p: 2000028d88 8
q: 2000028698 8
(t-mwhudson)mwhudson@am1:~$ ulimit -S -s 8192
(t-mwhudson)mwhudson@am1:~$ ./btp
p: 7f7fd086f0 0
q: 7f7fd08000 0

So something is clearly wrong; maybe it's just that the test is too
strict, but somehow that seems a bit unlikely.  FWIW, this doesn't
happen if you don't link with libpthread so maaaaybe it's a bug in
something that ends up in libpthread's .init section?

Cheers,
mwh

_______________________________________________
linaro-toolchain mailing list
linaro-toolchain@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-toolchain

Reply via email to