<div dir="ltr">+Richard</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Aug 12, 2014 at 3:51 AM, Stephan Bergmann <span dir="ltr"><<a href="mailto:sbergman@redhat.com" target="_blank">sbergman@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 08/11/2014 10:19 PM, Alexey Samsonov wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+Richard<br>
<br>
Note, that you'd also have to update comment for VtablePrefix::Offset field.<br>
</blockquote>
<br></div>
ah, right; updated patch<span class="HOEnZb"><font color="#888888"><br>
<br>
Stephan<br>
<br>
</font></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">
On Mon, Aug 11, 2014 at 6:30 AM, Stephan Bergmann <<a href="mailto:sbergman@redhat.com" target="_blank">sbergman@redhat.com</a><br></div><div><div class="h5">
<mailto:<a href="mailto:sbergman@redhat.com" target="_blank">sbergman@redhat.com</a>>> wrote:<br>
<br>
    At least with recent Clang trunk on Linux x86_64:<br>
<br>
        $ cat test.cc<br>
        #include <iostream><br>
        struct A { virtual ~A() {} };<br>
        struct B: virtual A {};<br>
        struct C: virtual A { ~C() { std::cout << '\n'; } };<br>
        struct D: virtual B, virtual C {};<br>
        int main() { delete new D; }<br>
<br>
        $ clang++ -fsanitize=undefined test.cc<br>
<br>
        $ ./a.out<br>
        <unknown>: runtime error: member call on address 0x000002a35010<br>
        which does not point to an object of type 'A'<br>
        0x000002a35010: note: object has invalid vptr<br>
          00 00 00 00  58 0e 43 00 00 00 00 00  30 0e 43 00 00 00 00 00<br>
          00 00 00 00 00 00 00 00  e1 0f 02 00<br>
                       ^~~~~~~~~~~~~~~~~~~~~~~<br>
                       invalid vptr<br>
<br>
<br>
    The problem is that getVtablePrefix (lib/ubsan/ubsan_type_hash.cc)<br>
    rejects any VtablePrefix with Offset > 0 as "This can't possibly be<br>
    a valid vtable" but, according to the Itanium ABI, "in some<br>
    construction virtual tables will some virtual base virtual tables<br>
    have positive offsets."<br>
<br>
    The apparent fix is to remove the check, see the attached<br>
    getVtablePrefix.patch.<br>
</div></div></blockquote>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Alexey Samsonov<br><a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a></div>
</div>