Comment #7 on issue 367 by [email protected]: sanitizer prevents linking, tons of undefined references
https://code.google.com/p/address-sanitizer/issues/detail?id=367

Except that the resulting program does not seem to run properly when some header files (like <mutex>) are involved:

$ clang++-mp-3.5 -fsanitize=undefined -fsanitize=address -std=c++11 -o t t.cpp -lc++abi
$ ./t
/opt/local/libexec/llvm-3.5/bin/../include/c++/v1/locale:1509:13: runtime error: member call on address 0x7fff7b62f068 which does not point to an object of type 'std::__1::basic_streambuf<char, std::__1::char_traits<char>
'
0x7fff7b62f068: note: object is of type 'std::__1::__stdoutbuf<char>'
00 00 00 00 10 05 63 7b ff 7f 00 00 70 fc 62 7b ff 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'std::__1::__stdoutbuf<char>'
/opt/local/libexec/llvm-3.5/bin/../include/c++/v1/streambuf:360:12: runtime error: member call on address 0x7fff7b62f068 which does not point to an object of type 'std::__1::basic_streambuf<char, std::__1::char_traits<char>
'
0x7fff7b62f068: note: object is of type 'std::__1::__stdoutbuf<char>'
00 00 00 00 10 05 63 7b ff 7f 00 00 70 fc 62 7b ff 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'std::__1::__stdoutbuf<char>'
/opt/local/libexec/llvm-3.5/bin/../include/c++/v1/iterator:906:53: runtime error: member call on address 0x7fff7b62f068 which does not point to an object of type 'std::__1::basic_streambuf<char, std::__1::char_traits<char>
'
0x7fff7b62f068: note: object is of type 'std::__1::__stdoutbuf<char>'
00 00 00 00 10 05 63 7b ff 7f 00 00 70 fc 62 7b ff 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'std::__1::__stdoutbuf<char>'
/opt/local/libexec/llvm-3.5/bin/../include/c++/v1/streambuf:349:9: runtime error: member access within address 0x7fff7b62f068 which does not point to an object of type 'std::__1::basic_streambuf<char, std::__1::char_traits<char> >'
0x7fff7b62f068: note: object is of type 'std::__1::__stdoutbuf<char>'
00 00 00 00 10 05 63 7b ff 7f 00 00 70 fc 62 7b ff 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'std::__1::__stdoutbuf<char>'
/opt/local/libexec/llvm-3.5/bin/../include/c++/v1/streambuf:349:20: runtime error: member access within address 0x7fff7b62f068 which does not point to an object of type 'std::__1::basic_streambuf<char, std::__1::char_traits<char> >'
0x7fff7b62f068: note: object is of type 'std::__1::__stdoutbuf<char>'
00 00 00 00 10 05 63 7b ff 7f 00 00 70 fc 62 7b ff 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'std::__1::__stdoutbuf<char>'
/opt/local/libexec/llvm-3.5/bin/../include/c++/v1/streambuf:350:16: runtime error: member call on address 0x7fff7b62f068 which does not point to an object of type 'std::__1::basic_streambuf<char, std::__1::char_traits<char>
'
0x7fff7b62f068: note: object is of type 'std::__1::__stdoutbuf<char>'
00 00 00 00 10 05 63 7b ff 7f 00 00 70 fc 62 7b ff 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'std::__1::__stdoutbuf<char>'
Program compiled and linked with mutex fine.
/opt/local/libexec/llvm-3.5/bin/../include/c++/v1/ostream:965:21: runtime error: member call on address 0x7fff7b62f068 which does not point to an object of type 'std::__1::basic_streambuf<char, std::__1::char_traits<char>
'
0x7fff7b62f068: note: object is of type 'std::__1::__stdoutbuf<char>'
00 00 00 00 10 05 63 7b ff 7f 00 00 70 fc 62 7b ff 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'std::__1::__stdoutbuf<char>'
/opt/local/libexec/llvm-3.5/bin/../include/c++/v1/streambuf:273:12: runtime error: member call on address 0x7fff7b62f068 which does not point to an object of type 'std::__1::basic_streambuf<char, std::__1::char_traits<char>
'
0x7fff7b62f068: note: object is of type 'std::__1::__stdoutbuf<char>'
00 00 00 00 10 05 63 7b ff 7f 00 00 70 fc 62 7b ff 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'std::__1::__stdoutbuf<char>'
argc=1  argv[0]=./t
$


Here's the source:

$ cat t.cpp
#include <iostream>
#include <mutex>

int main(int argc, char **argv) {

        std::cout << "Program compiled and linked with mutex fine."
                  << std::endl;

        std::cout << "argc=" << argc << "  argv[0]=" << argv[0] << std::endl;

}
$ clang++-mp-3.5 -v
clang version 3.5.0 (tags/RELEASE_350/final)
Target: x86_64-apple-darwin13.4.0
Thread model: posix


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to