<div dir="ltr">The UBSan runtime's support for type checks of virtual bases is new and possibly incorrect.</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 4, 2014 at 1:12 PM, Eric Fiselier <span dir="ltr"><<a href="mailto:eric@efcs.ca" target="_blank">eric@efcs.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">LLVM and libc++ always seem to use '-fno-sanitize=vptr,function' and<br>
'-fno-sanitize-recover' with UBSAN. I imagine adding these will remove<br>
the error.<br>
I would ask the compiler-rt people about the error on llvm-dev.<br>
<span class="HOEnZb"><font color="#888888"><br>
/Eric<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Thu, Dec 4, 2014 at 2:05 PM, Eric Fiselier <<a href="mailto:eric@efcs.ca">eric@efcs.ca</a>> wrote:<br>
> Did you compile libc++ with UBSAN?<br>
><br>
> /Eric<br>
><br>
> On Thu, Dec 4, 2014 at 6:21 AM, İsmail Dönmez <<a href="mailto:ismail@donmez.ws">ismail@donmez.ws</a>> wrote:<br>
>> I got some very simple code, dumbed down from a larger one:<br>
>><br>
>> [~]> cat wc.cpp<br>
>> #include <iostream><br>
>><br>
>> int wc() {<br>
>> return 0;<br>
>> }<br>
>><br>
>> int main()<br>
>> {<br>
>> std::cout << wc() << std::endl;<br>
>> }<br>
>><br>
>> [~]> /opt/clang/bin/clang++ -stdlib=libc++ -fsanitize=undefined wc.cpp<br>
>> [~]> ./a.out<br>
>> /opt/clang/bin/../include/c++/v1/ostream:1034:14: runtime error: member call<br>
>> on address 0x000000ef9858 which does not point to an object of type<br>
>> 'std::__1::basic_ios<char>'<br>
>> 0x000000ef9850: note: object is base class subobject at offset 8 within<br>
>> object of type 'std::__1::basic_ostream<char, std::__1::char_traits<char> >'<br>
>> 00 00 00 00 40 a3 b9 c6 b1 7f 00 00 68 a3 b9 c6 b1 7f 00 00 02 10 00 00<br>
>> 00 00 00 00 06 00 00 00<br>
>> ^ ~~~~~~~~~~~~~~~~~~~~~~~<br>
>> vptr for '<unknown>' base class of<br>
>> 'std::__1::basic_ostream<char, std::__1::char_traits<char> >'<br>
>> /opt/clang/bin/../include/c++/v1/ios:734:41: runtime error: member call on<br>
>> address 0x000000ef9858 which does not point to an object of type<br>
>> 'std::__1::ios_base'<br>
>> 0x000000ef9850: note: object is base class subobject at offset 8 within<br>
>> object of type 'std::__1::basic_ostream<char, std::__1::char_traits<char> >'<br>
>> 00 00 00 00 40 a3 b9 c6 b1 7f 00 00 68 a3 b9 c6 b1 7f 00 00 02 10 00 00<br>
>> 00 00 00 00 06 00 00 00<br>
>> ^ ~~~~~~~~~~~~~~~~~~~~~~~<br>
>> vptr for '<unknown>' base class of<br>
>> 'std::__1::basic_ostream<char, std::__1::char_traits<char> >'<br>
>> 0<br>
>><br>
>><br>
>> Works fine if I link to libstdc++. clang is r223341.<br>
>><br>
>><br>
>> _______________________________________________<br>
>> cfe-dev mailing list<br>
>> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
>><br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</div></div></blockquote></div><br></div>