[llvm-bugs] [Bug 40607] New: [ubsan] False positive object-size error in constructors of classes with multiple virtual inheritance

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Feb 5 06:34:27 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40607

            Bug ID: 40607
           Summary: [ubsan] False positive object-size error in
                    constructors of classes with multiple virtual
                    inheritance
           Product: compiler-rt
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: ubsan
          Assignee: unassignedbugs at nondot.org
          Reporter: ngg at tresorit.com
                CC: llvm-bugs at lists.llvm.org

Compile the following example with `-O2 -fsanitize=object-size`:

/// BEGIN EXAMPLE

struct A {
   virtual ~A() {}
};
struct B {};
struct C : virtual B {
   int i;
};
struct D : virtual A, C {};
struct E : virtual D {};

int main()
{
   E e;
}

/// END EXAMPLE

This gives the following error:

x.cpp:9:8: runtime error: constructor call on address 0x7ffcd6df0788 with
insufficient space for an object of type 'D'
0x7ffcd6df0788: note: pointer points here
 00 00 00 00  00 4e 55 ad c0 3a 94 ed  00 00 00 00 00 00 00 00  07 fb af 82 67
7f 00 00  18 0a 64 00
              ^ 

I could reproduce this problem with clang 7.0.1 and current trunk (as of
02/05/2019).
This does not occur with -O1, or if I try to further simplify the class
hierarchy.

-- 
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/20190205/4bc2c0a9/attachment.html>


More information about the llvm-bugs mailing list