This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Use malloca instead alloca


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]