This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Forbid __builtin_return_address when inlining


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]