[LLVMbugs] [Bug 18434] New: [-cxx-abi microsoft] bad layout involving empty struct field and empty virtual bases
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Jan 9 19:39:44 PST 2014
http://llvm.org/bugs/show_bug.cgi?id=18434
Bug ID: 18434
Summary: [-cxx-abi microsoft] bad layout involving empty struct
field and empty virtual bases
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
given:
#if defined(__clang__) || defined(__GNUC__)
typedef __SIZE_TYPE__ size_t;
#endif
extern "C" int printf(const char *fmt, ...);
static char buffer[419430400];
inline void *operator new(size_t, void *pv) { return pv; }
struct A {
char Field;
A() { printf("Field: %d\n", (int)&Field - (int)buffer); }
};
struct B {};
struct C : A {};
struct D : virtual C {
struct {} DField;
};
struct E : virtual D, virtual B, virtual A {};
int main() { new (buffer) E; }
MSVC gives:
Field: 4
Field: 16
clang gives:
Field: 4
Field: 20
--
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/20140110/9903eec3/attachment.html>
More information about the llvm-bugs
mailing list