This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: alloca and parameter passing


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.

Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]