This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Forbid __builtin_return_address when inlining
Andrew Haley writes:
> Mark Mitchell writes:
> > Andrew Haley wrote:
> > > __builtin_return_address(0) returns the wrong address if its caller
> > > has been inlined. Weirdly, we never seem to have detected this
> > > before, but it surely must be wrong.
> >
> > The manual says:
> >
> > > When
> > > inlining the expected behavior is that the function will return
> > > the address of the function that will be returned to. To work
> > > around this behavior use the `noinline' function attribute.
> >
> > which seems to suggest that the behavior you are seeing as is
> > documented, peculiar though it seems.
>
> Hmm, OK. But if I fixed the peculiar behavour then I could also
> remove the peculiar documentation, couldn't I? That would surely be
> an improvement.,,
Just to clarify: it's really easy for me just to fix this in the Java
langauge front-end, but that seems a little selfish.
Andrew.