freebsd-dev/lib/libthr
Dimitry Andric b34d83a709 The TCB_GET32() and TCB_GET64() macros in the i386 and amd64-specific
versions of pthread_md.h have a special case of dereferencing a null
pointer.  Clang warns about this with:

In file included from lib/libthr/arch/i386/i386/pthread_md.c:36:
lib/libthr/arch/i386/include/pthread_md.h:96:10: error: indirection of non-volatile null pointer will be deleted, not trap [-Werror,-Wnull-dereference]
        return (TCB_GET32(tcb_self));
                ^~~~~~~~~~~~~~~~~~~
lib/libthr/arch/i386/include/pthread_md.h:73:13: note: expanded from:
            : "m" (*(u_int *)(__tcb_offset(name))));            \
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/libthr/arch/i386/include/pthread_md.h:96:10: note: consider using __builtin_trap() or qualifying pointer with 'volatile'

Since this indirection is done relative to the fs or gs segment, to
retrieve thread-specific data, it is an exception to the rule.

Therefore, add a volatile qualifier to tell the compiler we really want
to dereference a zero address.

MFC after:	1 week
2011-12-15 19:42:25 +00:00
..
arch The TCB_GET32() and TCB_GET64() macros in the i386 and amd64-specific 2011-12-15 19:42:25 +00:00
support Merge from tbemd, with a small amount of rework: 2010-09-13 01:43:10 +00:00
sys
thread Pass CVWAIT flags to kernel, this should handle 2011-11-17 01:43:50 +00:00
libthr.3 mdoc: order prologue macros consistently by Dd/Dt/Os 2010-04-14 19:08:06 +00:00
Makefile Oops, don't remove -fexceptions flag. 2010-10-08 01:53:33 +00:00
pthread.map Introduce a non-portable function pthread_getthreadid_np(3) to retrieve 2011-02-07 21:26:46 +00:00