[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Proposal for handling alloca(). Anyone see a problem

From: Daniel Glöckner
Subject: Re: [Tinycc-devel] Proposal for handling alloca(). Anyone see a problem with it?
Date: Mon, 7 May 2007 19:43:16 +0200
User-agent: Mutt/

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
parameter list.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]