This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix 21166
Nathan Sidwell writes:
>
> > Agreed. I've always thought it completely unintuitive that plain
> > __attribute__((aligned(2))) is supposed to be ignored if the natural
> > alignment is greater than 2; you're supposed to use packed as well.
> No argument here. We have the funny situation where aligned(1) means
> something different from packed.
There are some code bases that rely on the current documented
behaviour. People who need an int field that is aligned as much as a
struct can write:
int __attribute__((aligned(__alignof__(struct foo)))
and then they have an object that is suitably aligned for both int and
foo. This is useful behaviour, and I don't think we should change it.
Andrew.