[LLVMbugs] [Bug 18694] New: MS ABI: Alignment of field following vbptr or vfptr is ignored.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Feb 1 21:21:45 PST 2014


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

            Bug ID: 18694
           Summary: MS ABI: Alignment of field following vbptr or vfptr is
                    ignored.
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david.majnemer at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

consider:
extern "C" int printf(const char *, ...);
#pragma pack(push, 1)
struct A {
  virtual void fun() {}
  __declspec(align(8)) int Field;
  A() {
    printf("F: %u\n", (char *)&Field - (char *)this);
  }
};
#pragma pack(pop)
int main() {
  A x;
  printf("sizeof(A):  %u\n", sizeof(A));
}

we get:
F: 4
sizeof(A):  8

msvc gets:
F: 8
sizeof(A):  16

NOTE: the problem also occurs if the vfptr is replaced with a vbptr.

-- 
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/20140202/042edcc8/attachment.html>


More information about the llvm-bugs mailing list