This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: __builtin_return_address (0) and inlining
On Jun 5, 2002, Eric Christopher <echristo@redhat.com> wrote:
> On Wed, 2002-06-05 at 14:46, Alexandre Oliva wrote:
>> On Jun 5, 2002, DJ Delorie <dj@redhat.com> wrote:
>>
>> > When converted, __builtin_return_address(0) will properly return the
>> > RA for the function it gets inlined into, rather than an unpredictable
>> > value.
>>
>> That's still probably not what the person who wrote
>> __builtin_return_address(0) wanted.
>>
> I'd agree with this. I think that this behavior would be unexpected.
But, truth be said, for someone who just wants to walk the stack, it
*would* be the right answer, and one that really cares about not
having the function inlined could mark the function with the noinline
attribute so as to get the expected answer. Which is why I was
undecided back when I wrote that code, and why I clearly still haven't
made my mind up :-)
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer