[LLVMbugs] [Bug 14983] New: [Windows] Wrong class layout in the presence of __int64 and vftable
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Jan 17 04:04:40 PST 2013
http://llvm.org/bugs/show_bug.cgi?id=14983
Bug #: 14983
Summary: [Windows] Wrong class layout in the presence of
__int64 and vftable
Product: clang
Version: trunk
Platform: PC
OS/Version: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: timurrrr at google.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
---test.cpp---
struct Base {
int x;
};
struct Child : Base {
__int64 y;
virtual void foo() {}
};
extern "C" int printf(const char *fmt, ...);
int main() {
Child s;
printf("x offset = %lu\n", (unsigned long)&s.x - (unsigned long)&s);
printf("y offset = %lu\n", (unsigned long)&s.y - (unsigned long)&s);
}
--------------
$ clang -cc1 -cxx-abi microsoft -triple i686-pc-win32 -fms-compatibility
-emit-llvm-only -fdump-record-layouts -o - test.cpp
...
*** Dumping AST Record Layout
0 | struct Child
4 | struct Base (base)
4 | int x
0 | (Child vftable pointer)
8 | long long y
| [sizeof=16, dsize=16, align=8
| nvsize=16, nvalign=8]
...
$ clang -Xclang -cxx-abi -Xclang microsoft -fno-rtti test.cpp && ./a.out
# Please note I have vtable generation code locally
x offset = 4
y offset = 8
Should be:
x offset = 8
y offset = 16
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list