Jouke Witteveen (3 December 2021 13:22) wrote:
> The next warning I get (GCC11) is a _return-local-addr_ warning in
> src/read.c:2534 (find_percent_cached). Maybe GCC doesn't recognize alloca as a
> heap allocation? Just guessing; this warning was not obvious to me.
alloca() is not a heap allocation:
<quote src="man alloca">
DESCRIPTION
The alloca() function allocates size bytes of space in the stack frame
of the caller. This temporary space is automatically freed when the
function that called alloca() returns to its caller.
</quote>
It is a stack allocation. So if make is returning an alloca()'d buffer,
then that is indeed a return of a local address.
Eddy.