This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Unexpected value-at for NULL'd pointer with pthreads


>> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]