<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] False positive object-size error in constructors of classes with multiple virtual inheritance"
   href="https://bugs.llvm.org/show_bug.cgi?id=40607">40607</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[ubsan] False positive object-size error in constructors of classes with multiple virtual inheritance
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>8.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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>ubsan
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ngg@tresorit.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</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>