[PATCH v2] Clean up check_pf allocation pattern. addresses
Ondřej Bílka
neleai@seznam.cz
Thu Jun 5 11:51:00 GMT 2014
On Wed, May 28, 2014 at 01:02:10PM +0200, Andreas Schwab wrote:
> OndÅej BÃlka <neleai@seznam.cz> writes:
>
> > No, that would not be problem if gcc optimized alloca alignment which it
> > does not do now.
>
> What do you mean with "alloca alignment"?
>
How that does expand in assembly, you need to align pointers to 16
bytes. A following fragment
int main()
{
char *x = alloca (42);
foo (x);
}
with stack pointer named sp growing downward gets expanded to
int main()
{
register char *tmp = sp;
sp -= 64;
char *x = (sp + 15) & (-16);
foo (x);
sp = tmp;
}
but when there is array
int main()
{
char *x[42];
foo (x);
}
then code becomes
int main()
{
sp -= 56;
x = sp;
foo (x);
sp += 56;
}
More information about the Libc-alpha
mailing list