------- Additional Comments From rguenth at tat dot physik dot uni-tuebingen dot de 2004-12-22 18:16 ------- Subject: Re: alloca returning unnecessarily aligned pointer and uses too much memory
pinskia at gcc dot gnu dot org wrote: > ------- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-22 > 15:06 ------- > The reason you cannot find anything in the C standard is because this is ABI > thing so this is invalid > > We need to keep the stack aligned sorry. Inside a function!? Or just at function callsites? Humm, the Intel compiler produces ..B1.3: # Preds ..B1.2 ..B1.4 movl $4, %eax #5.12 subl %eax, %esp #5.12 andl $-16, %esp #5.12 movl %esp, %eax #5.12 # LOE eax ebx ebp esi edi ..B1.4: # Preds ..B1.3 addl (%eax), %ebx #6.3 addl $1, %esi #4.21 cmpl %edi, %esi #4.2 jl ..B1.3 which looks like it aligns the stack after alloca, but it manages to waste less space by subtracting $4, not $32. Also if the ABI says the stack is aligned, why do we not make use of this and avoid the andl $-16, %esp -- or is the alignment only about alloca? I'm a bit confused. Richard. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19131