This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: On alignment
Michael Matz writes:
> On Thu, 20 Mar 2003, Jason Merrill wrote:
>
> > Do people think this bug is worth fixing? The behavior is rather
> > surprising, but changing it might break binary compatibility for affected
> > code--of which there's not likely to be very much, but there could be some.
> > Code which really wants, say, aligment of 4 for long long could say
> > __attribute__ ((packed, aligned (4))). On the other hand, the change would
> > restore binary compatibility with 2.95 for C code.
>
> This would change e.g the layout of things like:
>
> struct A { int i; };
> struct B { struct A a; long long int __attribute__((aligned(4))) li; };
> struct C { struct B b; int j; };
>
> , right? If yes I think there is not exactly few code which would be
> broken binary compatibility wise. I've seen strange things for instance
> in OpenOffice, where they play with alignments. And to this end
> compatibility with 3.x matters more that with 2.95.x.
Well, yes. But code which reasonably expects a field with alignof == 8
to be 8-aligned is broken at the present time.
Andrew.