Re: Extra space allocated for array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2008-04-20 at 11:16 -0700, Brian Dessent wrote:

> The stack pointer is always kept aligned to 16 bytes so that functions
> that require it (e.g. those that use SIMD operands) don't have to emit
> instructions to align it in the prologue.
> 
> Brian

That's what I thought. But notice the prologue:
main:
	pushq	%rbp
	movq	%rsp, %rbp
	subq	$88, %rsp

Now the stack pointer is not on a 16-byte boundary.

Reading the ABI carefully (n+1 times), I see that it says that the
16-byte boundary for the stack is the condition upon entry to a
function. The easiest way to do this is to allocate local variable space
in multiples of 16 in the prologue. Since this function does not call a
function, my take is that the 16-byte rule does not apply.

I ran this in gdb, and sure enough, the stack pointer is at an 8-byte
boundary, not 16-byte.

-- Bob



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux