This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Variable length arrays : aligned on stack
- From: Jean Christophe Beyler <jean dot christophe dot beyler at gmail dot com>
- To: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Mon, 23 Mar 2009 14:55:49 -0400
- Subject: Variable length arrays : aligned on stack
Dear all,
I've been looking to a problem where if I have this defined in the function:
void foo(int len)
{
long arr[len];
...
}
I get a complicated code to calculate the address of this
variable-length array. It seems that the compiler is aligning the
array when this code:
void foo(int len)
{
long arr[512];
...
}
Simply moves the stack pointer 512*sizeof(long) bytes down.
I suppose this is a Machine Description problem but was wondering if
you had any tips on where to look?
Thanks for your help,
Jean Christophe Beyler