This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: structure members of packed structures


> Another question. What about
> struct __attribute__((packed)) Foo
> {
>    T m;
> };
> 
> here m happens to fall at an aligned address, and the size of Foo happens
> to be a multiple of that alignment. Should m be DECL_PACKED or not?

I say yes.

If we're going to make attributes part of the type system, then the rule
ought to be that a packed Foo packs all of its members.  On a
STRICT_ALIGNMENT system, a packed Foo * and an ordinary Foo * should be
incompatible types.

Now, how badly this breaks everything is another question...

-- 
Mark Mitchell <mark@codesourcery.com>
CodeSourcery, LLC


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]