Forbid __builtin_return_address when inlining

Andrew Haley aph@redhat.com
Mon Nov 27 10:39:00 GMT 2006


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.,,

Andrew.



More information about the Gcc-patches mailing list