[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Proposal for handling alloca(). Anyone see a problem
Re: [Tinycc-devel] Proposal for handling alloca(). Anyone see a problem with it?
Mon, 7 May 2007 19:43:16 +0200
On Mon, May 07, 2007 at 12:31:00PM -0400, David A. Wheeler wrote:
> Many C compilers implement alloca() by simply manipulating the stack pointer.
> Indeed, grischka's patch does this (though only for x86-32 Windows). But in
> tinycc's case, the obvious way to do this will fail horrifically in many
> cases, because alloca() can be embedded inside an expression, like this:
> a( b(4+c()), alloca(x*g()), h()+n());
> In this example, a naive alloca implementation would be in the middle of
> computing this expression, with some intermediate values on the stack, and
> the alloca() call would then screw up the stack DURING the expression
> calculation... causing the whole expression to miscalculate.
Are you shure this can happen with tinycc?
AFAIR all parameters are evaluated before gfunc_call is called to put
them on the stack. So an embedded alloca can never generate holes in a
Re: [Tinycc-devel] Proposal for handling alloca(). Anyone see a problem with it?, Rob Landley, 2007/05/07