<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - UBSan vptr false positive with -fvisibility=hidden"
   href="https://bugs.llvm.org/show_bug.cgi?id=39191">39191</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>UBSan vptr false positive with -fvisibility=hidden
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>7.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nok.raven@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>There is a report on GCC bug tracker about the similar problem
<a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80963">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80963</a>

// foo.cpp
#include "foo.h"

void call_foo(Foo const& obj)
{
    obj.foo();
}

// foo.h
struct Foo
{
    virtual void foo() const = 0;
};

__attribute__((visibility("default"))) void call_foo(Foo const&);

// main.cpp
#include "foo.h"

struct Bar : Foo
{
    void foo() const override {}
};

int main()
{
    call_foo(Bar());
}


// run command
clang++-7 -fPIC -o libfoo.so -shared foo.cpp -fvisibility=hidden -Wall -Wextra
-pedantic -fsanitize=undefined && \
  clang++-7 -o main main.cpp ./libfoo.so -fvisibility=hidden -Wall -Wextra
-pedantic -fsanitize=undefined && \
  ./main

// output
foo.cpp:5:9: runtime error: member call on address 0x7ffd9212cb28 which does
not point to an object of type 'Foo'
0x7ffd9212cb28: note: object is of type 'Bar'
 fd 7f 00 00  08 69 43 00 00 00 00 00  50 e1 42 00 00 00 00 00  e1 82 2b 52 9c
7f 00 00  00 1c 01 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'Bar'</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>