[llvm-bugs] [Bug 39191] New: UBSan vptr false positive with -fvisibility=hidden
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Oct 5 07:50:19 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=39191
Bug ID: 39191
Summary: UBSan vptr false positive with -fvisibility=hidden
Product: new-bugs
Version: 7.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: nok.raven at gmail.com
CC: llvm-bugs at lists.llvm.org
There is a report on GCC bug tracker about the similar problem
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80963
// 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'
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181005/033d5f8a/attachment.html>
More information about the llvm-bugs
mailing list