This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Fix ICE on function [not] returning variable size
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 01 Jun 2015 23:08:05 +0200
- Subject: Re: [patch] Fix ICE on function [not] returning variable size
- Authentication-results: sourceware.org; auth=none
- References: <2953955 dot A7ElB1Yu05 at polaris> <CAFiYyc0d7qt3N1P5-wF-sT804twNd2KJfDXC3pGbYGDcMniPoA at mail dot gmail dot com>
> Ok. (I wonder if there are any cases where the return value is allocated by
> the callee?)
Thanks.
Do you mean in GCC or in programming languages in general or...? In GNAT, we
have something like that: when a function returns an unconstrained type whose
size depends on some discriminants of the type, the caller doesn't know the
size of the return value in advance, so the callee allocates the return value
on the "secondary stack" and effectively returns a pointer to it. Of course
you need a specific machinery to manage this secondary stack. And, needless
to say, this is quite inefficient, so we attempt to reduce its usage:
https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02632.html
--
Eric Botcazou