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: unassignedb...@nondot.org
          Reporter: n...@tresorit.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to