Forbid __builtin_return_address when inlining

Mark Mitchell mark@codesourcery.com
Mon Nov 27 02:29:00 GMT 2006


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.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc-patches mailing list