[LLVMdev] Proposed: first class packed structures
Chris Lattner
sabre at nondot.org
Fri Dec 8 11:42:57 PST 2006
On Fri, 8 Dec 2006, Andrew Lenharth wrote:
>> Here's an example of #1:
>> extern struct { int x; int y; int z; } __attribute((packed)) foos;;
>> This should just be {int,int,int}, not <{int,int,int}>.
>
> no, consider
> struct foo { int x; int y; int z; } __attribute((packed));
> struct {char c; struct foo f;} bar;
>
> sizeof(bar) == 13
> if struct foo wasn't packed it's allignment would force a larger size for bar;
I would expect the type of bar to be:
<{sbyte, {int,int,int} }>
which has size = 13.
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list