bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #60798] Make does not compile with GCC 11.1.0


From: Jouke Witteveen
Subject: Re: [bug #60798] Make does not compile with GCC 11.1.0
Date: Fri, 3 Dec 2021 13:33:42 +0100

On Fri, Dec 3, 2021 at 1:26 PM Edward Welbourne <edward.welbourne@qt.io> wrote:
>
> 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.
>

Ah, thanks! I see what is happening now. GCC fails to see that in case
allocations have happened, new is non-zero and the little block at the
end of the function will make sure that the final string allocation
will be copied to the string cache (and the returned address will
hence not be local).

I currently have no idea how to make this easier to understand for GCC.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]