This is the mail archive of the gcc-help@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: aligned attribute


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.



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