[LLVMdev] Weird error from Undefined Sanitizer

Eli Friedman eli.friedman at gmail.com
Tue Jul 30 14:12:50 PDT 2013


On Tue, Jul 30, 2013 at 2:01 PM, Marshall Clow <mclow.lists at gmail.com> wrote:
> # Everything is done on Mac OS X 10.8.4, with llvm/clang/libc++/libc++abi built from source this morning
> # totclang is an alias for the built clang.
>
> $ export LLVM=/Sources/LLVM
> $ export LIBCXX=$LLVM/libcxx
> $ export LIBCXXABI=$LLVM/libcxxabi
>
> $ totclang -std=c++11 -stdlib=libc++ -I $LIBCXX/include -fsanitize=undefined ubsan.cpp -L $LIBCXX/lib -L $LIBCXXABI/lib -lc++abi
> $ DYLD_LIBRARY_PATH=$LIBCXX/lib:$LIBCXXABI/lib ./a.out
> ubsan.cpp:22:5: runtime error: member call on address 0x7fff4fc2eaf0 which does not point to an object of type 'std::runtime_error'
> 0x7fff4fc2eaf0: note: object is of type 'std::runtime_error'
>  00 00 00 00  e0 7a b5 10 01 00 00 00  38 39 c0 7b dc 7f 00 00  ac b3 fd 0f 01 00 00 00  5e 20 bd 6f
>               ^~~~~~~~~~~~~~~~~~~~~~~
>               vptr for 'std::runtime_error'
> <unknown>: runtime error: member call on address 0x7fff4fc2eaf0 which does not point to an object of type 'std::runtime_error'
> 0x7fff4fc2eaf0: note: object is of type 'std::runtime_error'
>  00 00 00 00  e0 7a b5 10 01 00 00 00  38 39 c0 7b dc 7f 00 00  ac b3 fd 0f 01 00 00 00  5e 20 bd 6f
>               ^~~~~~~~~~~~~~~~~~~~~~~
>               vptr for 'std::runtime_error'
>
> Note: In a non-proportional font, the carets point to the 'e' in "e0 7a"
>
> So, what is at address 0x7fff4fc2eaf0?
>
> Is it:
>         a) an object of type 'std::runtime_error'
>         b) not an object of type 'std::runtime_error'

Have you considered "c) both"? :)

My guess is that there are multiple definitions of std::runtime_error
which aren't getting linked together correctly in the process.

-Eli



More information about the llvm-dev mailing list