This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: __builtin_return_address (0) and inlining
- From: Geoff Keating <geoffk at geoffk dot org>
- To: Eric Christopher <echristo at redhat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: 06 Jun 2002 01:26:06 -0700
- Subject: Re: __builtin_return_address (0) and inlining
- References: <1023306058.31387.50.camel@ghostwheel.cygnus.com>
Eric Christopher <echristo@redhat.com> writes:
> Currently if you use __builtin_return_address (0) in a function that is
> inlined you'll likely get the wrong answer. I think I remember a
> conversation a while back about this, but I couldn't seem to find it.
>
> Now, unfortunately the docs don't say a whole lot on the subject, just
> that for N > 0, __builtin_return_address should only be used for
> debugging purposes. I've taken a look at the code and it should be
> pretty easy to make __builtin_return_address work if we turn off
> inlining for those functions. Similar to the #if 0'd work in
> c-objc-common.c:96. Otherwise we should probably mention this in the
> docs. I'll work up a patch either way, I'd just like to see what the
Note that sibcall will also change __builtin_return_address, and you
can't turn off sibcall based on the routine that will be called...
--
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>