This is the mail archive of the
mailing list for the GCC project.
Re: Forbid __builtin_return_address when inlining
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Andrew Haley <aph at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 26 Nov 2006 18:02:46 -0800
- Subject: Re: Forbid __builtin_return_address when inlining
- References: <email@example.com>
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:
> 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.
(650) 331-3385 x713