This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: __builtin_return_address
- To: Eli Zaretskii <eliz at is dot elta dot co dot il>
- Subject: Re: __builtin_return_address
- From: Michael Meissner <meissner at cygnus dot com>
- Date: Wed, 1 Nov 2000 16:03:44 -0500
- Cc: zackw at stanford dot edu, spock at telerama dot com, gcc-bugs at gcc dot gnu dot org
- References: <20001101031821.21269.qmail@speedbuggy.telerama.com> <20001031194044.F8628@wolery.stanford.edu> <200011010850.DAA22655@indy.delorie.com>
On Wed, Nov 01, 2000 at 03:50:46AM -0500, Eli Zaretskii wrote:
> >
> > 2) You cannot rely on __builtin_return_address to return any
> > meaningful information whatsoever except when its argument is zero.
>
> ??? Then at least the GCC docs needs to be changed. It currently
> says (in v2.95.2 release):
>
> On some machines it may be impossible to determine the return
> address of any function other than the current one; in such cases,
> or when the top of the stack has been reached, this function will
> return `0'.
>
> According to this, all values but zero returned from
> __builtin_return_address should be valid.
>
> Also, is the platform the OP was talking about (Red Hat GNU/Linux)
> really one of those where __builtin_return_address doesn't work?
Ummm, Red Hat GNU/Linux runs on 3 different target hardwares. For the x86,
__builtin_return_address with a non-zero argument only has a chance of working
if the caller was not called with -fomit-frame-pointer.
--
Michael Meissner, Red Hat, Inc.
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work: meissner@redhat.com phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org fax: +1 978-692-4482