Further observations regarding alloca on i586-pc-linux-gnu

Richard Henderson rth@cygnus.com
Sun Aug 23 16:08:00 GMT 1998


On Sun, Aug 23, 1998 at 08:20:05PM +0200, Martin von Loewis wrote:
> > Note that the exact same effect would happen if alloca was not a
> > builtin.
> 
> No, it wouldn't. The portable alloca would not reclaim the memory
> until the next alloca call, and then only if the previous call was
> deeper on stack.

No no, I meant the olde tyme non-portable alloca.  You know:

	alloca: popl	%edx
		subl	%eax, %esp
		movl	%esp, %eax
		jmp	*%edx

> > Note that if you mind sequence points like you ought, you get
> > correct results.
> 
> The original example was using alloca as a default argument. It seems
> that g++ currently does not support that, an alloca call must occur as
> a full expression in itself, not inside a full expression.

"Full expression" isn't a term I'm familiar with.  Besides,

	(tmp = alloca(n), foo(tmp, blah));

works just fine.  It seems that alloca must be the first thing
after a sequence point.  How to enforce or even warn about this
I have absolutely no idea.


r~



More information about the Gcc-bugs mailing list