[cft] aligning main's stack frame

Andi Kleen ak@suse.de
Mon Oct 17 15:30:00 GMT 2005


Richard Henderson <rth@redhat.com> writes:

> main:
>         leal    4(%esp), %ecx		# create argument pointer
>         andl    $-16, %esp		# align stack
>         pushl   -4(%ecx)		# copy return address

This will misaligned the call/ret stack in the CPU, leading to branch
mispredictions on many of the following RETs. On main it's probably
not a big issue, but for other functions it might be.

-Andi



More information about the Gcc mailing list