[LLVMbugs] [Bug 18277] New: [-cxx-abi microsoft] vtordisps for virtual base should be placed before aligning virtual bases

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Dec 18 15:03:04 PST 2013


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

            Bug ID: 18277
           Summary: [-cxx-abi microsoft] vtordisps for virtual base should
                    be placed before aligning virtual bases
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rnk at google.com
                CC: llvmbugs at cs.uiuc.edu, whunt at google.com
    Classification: Unclassified

$ cat t.cpp
struct A {
  virtual ~A();
  long long ll;
};
struct B : A {
  virtual ~B();
  virtual void foo();
  int b;
};
struct C : virtual B {
  virtual ~C();
  virtual void foo();
};
extern "C" int printf(const char *, ...);
int main() {
  printf("sizeof(C): %d\n", sizeof(C));
}

$ cl -nologo t.cpp -GR- && ./t.exe 
t.cpp
sizeof(C): 32

$ clang-cl t.cpp -GR- && ./t.exe
sizeof(C): 40


*** Dumping AST Record Layout
   0 | struct C
   0 |   (C vbtable pointer)

... This padding here is unnecessary, and I assume that MSVC doesn't add it

  12 |   (vtordisp for vbase B)
  16 |   struct B (virtual base)
  16 |     struct A (primary base)
  16 |       (A vftable pointer)
  24 |       long long ll
  32 |     int b
     | [sizeof=40, align=8
     |  nvsize=4, nvalign=4]

-- 
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/20131218/d3f2e42e/attachment.html>


More information about the llvm-bugs mailing list