[PATCH] Use malloca instead alloca
Paul Eggert
eggert@cs.ucla.edu
Sat Jan 12 22:39:00 GMT 2013
On 01/12/2013 02:24 PM, Rich Felker wrote:
>> gcc does not optimize alloca
>> > well so type[constant] is faster than alloca(constant). This is bug in
>> > gcc and can be fixed.
> No, this _cannot_ be fixed. If any non-static-sized objects
Surely GCC can be fixed so that a function that does this first:
char *p = alloca (100);
is executed with code that's no slower than if the function had
done this first:
char buf[100];
char *p = buf;
Currently, GCC doesn't do this optimization, but I don't see any
reason why it couldn't.
There are other optimizations involving alloca (constant) that
GCC couldn't do, but the ones that OndÅej are talking about
seem doable.
More information about the Libc-alpha
mailing list