alloca and parameter passing

Florian Weimer
Wed Dec 30 12:05:00 GMT 2015

On 12/30/2015 08:32 AM, Jeff Law wrote:
> On 12/29/2015 11:06 AM, Florian Weimer wrote:
>> About fifteen years ago, GCC apparently did not seem to support calling
>> alloca as a nested expression in a function argument.  I can't image how
>> this limitation survived the switch to treessa.  Is it true that it's
>> long gone now?

> I don't explicitly recall it going away.

So does this restriction still exist or not?

> Note that the move to tree-ssa actually makes this kind of thing easier
> as the gimplifier will do the evaluation of the argument into a
> temporary and use the temporary in the function call.

Yes, the nested-ness of the alloca just doesn't survive in GIMPLE, hence
my disbelief this limitation still exists.

Older (non-compiler) alloca implementations probably relied on the frame
pointer and manipulated the stack pointer directly.  This could
interfere with pushing arguments on the stack.  But the days where such
trickery could work at least in some cases are long gone.

We mention the restriction in the glibc manual, which is why I'm
interested in this topic.  I suspect we should not mention this
restriction anymore.


More information about the Gcc-help mailing list