[llvm-bugs] [Bug 30478] New: UBSan vptr: false positive if virtual method if privately overriden
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Sep 21 12:03:04 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=30478
Bug ID: 30478
Summary: UBSan vptr: false positive if virtual method if
privately overriden
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: krasin at google.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Created attachment 17329
--> https://llvm.org/bugs/attachment.cgi?id=17329&action=edit
many_bases.cc
Based on the analysis of a Chromium test failure that feels like a false
positive from UBSan's vptr check, I have come up with the following minimal
reproducer:
many_bases.cc (also attached):
#include <stdio.h>
class Base1 {
public:
virtual void Do() { printf("Base1::Do\n"); }
};
class Base2 {
public:
virtual void Do2() { printf("Base2::Do2\n"); }
};
class Derived final : public Base1, public Base2 {
private:
void Do2() override { printf("Derived::Do2\n"); }
};
int main(void) {
Derived obj;
static_cast<Base2*>(&obj)->Do2();
}
Compiling and running:
$ clang++ -o many_bases many_bases.cc -fsanitize=vptr
-fno-sanitize-recover=undefined -fvisibility=hidden -std=gnu++11 &&
./many_bases
many_bases.cc:20:30: runtime error: member call on address 0x7ffe64429bb8 which
does not point to an object of type 'Base2'
0x7ffe64429bb8: note: object is of type 'Derived'
ea 46 63 ba c0 ee 42 00 00 00 00 00 e0 ee 42 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'Derived'
The error message does not make sense to me.
--
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/20160921/034750be/attachment.html>
More information about the llvm-bugs
mailing list