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


* Alexandre Oliva <aoliva@redhat.com> [27/07/2001 01:35]:
> I believe the problem is that the alignment of automatic variables is
> limited to PREFERRED_STACK_BOUNDARY and to whatever alignment the C
> library sets up in its initialization code.  Even though
> PREFERRED_STACK_BOUNDARY has defaulted to 16 bytes these days, I think
> most (if not all) versions of glibc only guarantee 8-byte alignment of
> the stack.

I'm afraid I don't see the connection between glibc and
__attribute__((aligned())).

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>


which should then make esp aligned properly (the above may not be
entirely correct... I'm writing the e-mail very late at night after a
looooong day of hacking :) )

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

char c;
vector v1;

my vector will be misaligned by sizeof(char).

Hope this clears it up.

-- 
Ryan T. Sammartino
http://members.home.net/ryants/
If you talk to God, you are praying; if God talks to you, you have
schizophrenia.
		-- Thomas Szasz


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