alloca and parameter passing

Jeff Law law@redhat.com
Fri Jan 1 18:14:00 GMT 2016


On 12/30/2015 05:05 AM, Florian Weimer wrote:
> 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?
I would think not.

>
>
> 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.
There were multiple approaches, some even used malloc under the hood 
IIRC.  But it's been a long time since anyone worried about supporting 
alloca outside the compiler and the details of the various 
implementations have long since been dropped out my brain.

>
> 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.
Agreed.

jeff



More information about the Gcc-help mailing list