[LLVMbugs] [Bug 18021] New: [-cxx-abi microsoft] Clang lays class out wrong when most derived class has a bitfield
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Nov 21 19:00:09 PST 2013
http://llvm.org/bugs/show_bug.cgi?id=18021
Bug ID: 18021
Summary: [-cxx-abi microsoft] Clang lays class out wrong when
most derived class has a bitfield
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
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:
#include <stddef.h>
#include <stdio.h>
#include <string.h>
char buffer[419430400];
inline void *operator new(size_t, void *pv) { return pv; }
struct ClassName00 {
long long ClassName00FieldName00;
ClassName00() {
printf("ClassName00FieldName00 : %llu\n", (unsigned long
long)((size_t)&ClassName00FieldName00 - (size_t)buffer));
}
};
struct ClassName02: public virtual ClassName00 {
long long ClassName02FieldName00;
ClassName02() {
printf("ClassName02FieldName00 : %llu\n", (unsigned long
long)((size_t)&ClassName02FieldName00 - (size_t)buffer));
}
};
struct ClassName03: public virtual ClassName02 {
int ClassName03FieldName3 : 1;
ClassName03() {
}
};
int main() {
memset(buffer, 0, sizeof(buffer));
new (buffer) ClassName03;
printf(" sizeof(ClassName03): %Iu\n", sizeof(ClassName03));
printf("__alignof(ClassName03): %Iu\n", __alignof(ClassName03));
memset(buffer, 0, sizeof(buffer));
}
clang gives us:
ClassName00FieldName00 : 16
ClassName02FieldName00 : 32
sizeof(ClassName03): 40
__alignof(ClassName03): 8
MSVC gives us:
ClassName00FieldName00 : 16
ClassName02FieldName00 : 40
sizeof(ClassName03): 48
__alignof(ClassName03): 8
--
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/20131122/aee952df/attachment.html>
More information about the llvm-bugs
mailing list