[LLVMbugs] [Bug 18610] New: ABI incompatibility with GCC regarding aligned virtual base
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Jan 24 23:49:01 PST 2014
http://llvm.org/bugs/show_bug.cgi?id=18610
Bug ID: 18610
Summary: ABI incompatibility with GCC regarding aligned virtual
base
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
We place an aligned virtual base at an offset which is not a multiple of it's
alignment.
consider:
extern "C" int printf(const char *, ...);
struct A {};
struct __attribute__((aligned(16))) B : A {};
#pragma pack(push, 8)
struct C : virtual B, A {};
#pragma pack(pop)
int main() {
printf("sizeof(C): %zu\n", sizeof(C));
}
compile with:
~/llvm/build/bin/clang++ -cc1 -triple x86_64-unknown-linux-gnu different.cpp -o
clang_test
clang gives us 24
gcc gives us 32
also:
$ ~/llvm/build/bin/clang++ -cc1 different.cpp -fdump-record-layouts
-emit-llvm-only
*** Dumping AST Record Layout
0 | struct A (empty)
| [sizeof=1, dsize=1, align=1
| nvsize=1, nvalign=1]
*** Dumping AST Record Layout
0 | struct B (empty)
0 | struct A (base) (empty)
| [sizeof=16, dsize=0, align=16
| nvsize=1, nvalign=16]
*** Dumping AST Record Layout
0 | struct C
0 | (C vtable pointer)
0 | struct A (base) (empty)
8 | struct B (virtual base) (empty)
8 | struct A (base) (empty)
| [sizeof=24, dsize=8, align=8
| nvsize=8, nvalign=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/20140125/c1660c42/attachment.html>
More information about the llvm-bugs
mailing list