aligned attribute
Tim Prince
timothyprince@sbcglobal.net
Thu Dec 21 21:21:00 GMT 2006
Andrew Haley wrote:
> Maurizio Vitale writes:
> > But when I move to my real application (an event-driven simulator) I
> > get stack allocated objects on 8-byte boundaries.
> >
> > Now, my reading of the documentation is that the aligned attribute
> > (when used for types, as in the example I gave) applies to all
> > allocations (global, auto and heap). Is there any place where it is
> > said otherwise? Regardless of the documentation, what does the
> > implementation do?
>
> You can't get alignment any greater than the alignment of the stack
> pointer. The alignment of the stack pointer is defined the the ABI of
> the particular target you're using. I think it's 16 for x86
> processors, but the processor itself doesn't enforce that: it varies
> across operating systems and processor variants.
It is also possible to build binutils with support for maximum alignment
less than 16. This was often done prior to widespread option of sse on
Opteron, for example. The compiler can't determine if the linker or OS
aren't supporting as large alignments as the compiler.
More information about the Gcc-help
mailing list