[LLVMbugs] [Bug 18186] New: [-cxx-abi microsoft] vfptr not properly aligned?
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Dec 9 03:51:07 PST 2013
http://llvm.org/bugs/show_bug.cgi?id=18186
Bug ID: 18186
Summary: [-cxx-abi microsoft] vfptr not properly aligned?
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:
#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 ClassName0 {
bool ClassName0FieldName0;
ClassName0() {
printf(
"ClassName0 - this: %llu\n",
(unsigned long long)((size_t) this - (size_t)buffer));
printf(
"ClassName0FieldName0 : %llu\n",
(unsigned long long)((size_t) & ClassName0FieldName0 -
(size_t)buffer));
}
};
struct ClassName1 : public ClassName0 {
virtual void ClassName1Method() {}
ClassName1() {
printf(
"ClassName1 - this: %llu\n",
(unsigned long long)((size_t) this - (size_t)buffer));
}
};
struct ClassName2 : public ClassName1, public ClassName0 {
virtual void ClassName2Method() {}
ClassName2() {
printf(
"ClassName2 - this: %llu\n",
(unsigned long long)((size_t) this - (size_t)buffer));
}
};
struct ClassName3 : public ClassName0, public ClassName1, public ClassName2 {
ClassName3() {
printf(
"ClassName3 - this: %llu\n",
(unsigned long long)((size_t) this - (size_t)buffer));
}
};
static void test_layout(const char *class_name, size_t size_of_class,
size_t align_of_class) {}
template <typename Class>
static void init_mem() {
new (buffer) Class;
}
#define test(Class) \
init_mem<Class>(), test_layout(#Class, sizeof(Class), __alignof(Class))
int main() { test(ClassName3); }
msvc:
ClassName0 - this: 20
ClassName0FieldName0 : 20
ClassName0 - this: 4
ClassName0FieldName0 : 4
ClassName1 - this: 0
ClassName0 - this: 12
ClassName0FieldName0 : 12
ClassName1 - this: 8
ClassName0 - this: 16
ClassName0FieldName0 : 16
ClassName2 - this: 8
ClassName3 - this: 0
clang:
ClassName0 - this: 8
ClassName0FieldName0 : 8
ClassName0 - this: 4
ClassName0FieldName0 : 4
ClassName1 - this: 0
ClassName0 - this: 16
ClassName0FieldName0 : 16
ClassName1 - this: 12
ClassName0 - this: 20
ClassName0FieldName0 : 20
ClassName2 - this: 12
ClassName3 - this: 0
--
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/20131209/7cddc7ea/attachment.html>
More information about the llvm-bugs
mailing list