[LLVMbugs] [Bug 14949] New: Struct packing doesn't work properly with -m32
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Jan 14 07:59:12 PST 2013
http://llvm.org/bugs/show_bug.cgi?id=14949
Bug #: 14949
Summary: Struct packing doesn't work properly with -m32
Product: clang
Version: 3.0
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: llvm at inequation.org
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 9871
--> http://llvm.org/bugs/attachment.cgi?id=9871
Simple program that fails to compile because of struct packing not working
properly
When cross-compiling from amd64 to i386 by using the -m32 option, struct
packing doesn't work. Attached is a simple C++ source that fails to compile.
Please also note that there is another typedef should fail (negative array
size) but does not. By commenting out the typedefs altogether you can check
that the offset of the member a is 4 and not 8.
inequation at spearhead:~$ clang pack-test.cpp -o test -m32
pack-test.cpp:6:28: error: 'equality_test' declared as an array with a negative
size
typedef char equality_test[(offsetof(test, a) == 8) ? 1 : -1];
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
inequation at spearhead:~$ clang -v
Debian clang version 3.0-6 (tags/RELEASE_30/final) (based on LLVM 3.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
--
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