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]

Re: __attribute__((aligned(16)) on x86


> Date: Sat, 28 Jul 2001 02:03:56 -0700
> From: "Ryan T. Sammartino" <ryants@home.com>
> To: Alexandre Oliva <aoliva@redhat.com>

> When I have something on the stack that is aligned to a certain
> boundary, I expect the compiler to do something like:

> sub 8, %esp
> and -16, %esp
> add 4, %esp
> <now put variables on the stack>

You might expect that, but gcc doesn't have the beef to manage to do
this.

> Aligning the stack is no good, since if I do something like:

> char c;
> vector v1;

> my vector will be misaligned by sizeof(char).

You misunderstand.  Examine how alignment of global data can work
with:

char c;
double d;

Hint, you pack c with and around other small things, and put d on an 8
boundary.


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