Unexpected value-at for NULL'd pointer with pthreads
Jeffrey Walton
noloader@gmail.com
Fri Aug 21 23:13:00 GMT 2015
>> Without looking at the code, I suggest trying GCC's -sanitize=thread option and/or valgrind's helgrind tool.
>
> I wasn't able to get -fsanitize=thread to compile. I moved to a VM
> with gcc 4.8+, installed libtsan0 (Trusty) and added the other flags
> (-pie etc) but it kept complaining the __tsan functions were
> undefined. Am I missing something to get this working?
I seem to recall having to install libubsan and libasan for the
Undefined Behavior and Address sanitizers (the ones I use). Maybe you
need to install libtsan or similar?
All you should need to do is add -fsanitize=thread to CFLAGS or
CXXFLAGS. If you are linking through the compiler driver, then the
CFLAGS or CXXFLAGS should be present with -fsanitize=thread, too. If
you are linking directly through LD, then I think -fsanitize=thread
needs to be provided in LDFLAGS.
Jeff
More information about the Gcc-help
mailing list