[LLVMbugs] [Bug 16406] New: [-cxx-abi microsoft] Wrong layout due to mistakenly injected vtorDisp

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jun 21 06:15:23 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16406

            Bug ID: 16406
           Summary: [-cxx-abi microsoft] Wrong layout due to mistakenly
                    injected vtorDisp
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: timurrrr at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

=== vtordisp_layout.cpp ===
class A { 
  virtual void f();
};

class B : virtual A { 
  virtual void f();
};

class C : virtual B {}; 

extern "C" int printf(const char *fmt, ...);

int main() {
  printf("sizeof(C) = %lu\n", sizeof(C));
}
===========================

As of r184536,
$ clang -cc1 -fno-rtti -fdump-record-layouts -cxx-abi microsoft
-triple=i386-pc-win32 -emit-llvm-only -o - vtordisp_layout.cpp

prints out

*** Dumping AST Record Layout
   0 | class B
   0 |   (B vbtable pointer)
   4 |   (vtordisp for vbase A)
   8 |   class A (virtual base)
   8 |     (A vftable pointer)
     | [sizeof=12, dsize=12, align=4
     |  nvsize=4, nvalign=4]


*** Dumping AST Record Layout
   0 | class C
   0 |   (C vbtable pointer)
   4 |   (vtordisp for vbase A)
   8 |   class A (virtual base)
   8 |     (A vftable pointer)
  12 |   class B (virtual base)
  12 |     (B vbtable pointer)
     | [sizeof=16, dsize=16, align=4
     |  nvsize=4, nvalign=4]

There should not be vtordisp in B, nor should it be in C.

sizeof(B) should be 8, sizeof(C) should be 12.

-- 
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/20130621/bd690f4d/attachment.html>


More information about the llvm-bugs mailing list