This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: alloca and parameter passing
- From: Florian Weimer <fweimer at redhat dot com>
- To: Jeff Law <law at redhat dot com>, "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Wed, 30 Dec 2015 13:05:52 +0100
- Subject: Re: alloca and parameter passing
- Authentication-results: sourceware.org; auth=none
- References: <5682CBA5 dot 901 at redhat dot com> <5683887E dot 6040507 at redhat dot com>
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