__builtin_return_address

Zack Weinberg zackw@Stanford.EDU
Thu Nov 2 10:44:00 GMT 2000


On Thu, Nov 02, 2000 at 05:33:30AM -0500, Eli Zaretskii wrote:
> >   Date: Thu, 2 Nov 2000 00:19:47 -0800
> >   From: "Zack Weinberg" <zackw@Stanford.EDU>
> >
> >   You're missing the point here.  Yes, on x86/linux without
> >   -fomit-frame-pointer, __builtin_return_address(N) for N>0 is more
> >   likely to work than on some other platforms.  It still isn't
> >   guaranteed.  It might return zero back when there's still stack
> >   frames, skip over active frames, surprise you with frames you didn't
> >   expect, or crash instead of returning 0 when you run out of frames.
> >   And I wouldn't be too shocked if it made demons fly out of my nose,
> >   either.
> 
> All I've said originally was that the current GCC docs does not say
> anything about undefined/unguaranteed behavior, and neither does it
> mention demons flying out of your nose.  It says that
> __builtin_return_address either returns a valid address, or, if it
> can't get a valid address, it returns zero.
> 
> Therefore, I suggested to amend the docs.
> 
> Now, what point does this observation miss?

I read your original report as requesting that the implementation be
made to match the docs, not the other way around.  I've been running
on very little sleep all week, so I may have misunderstood, and I was
certainly grouchier about it than I should have.  I apologize.

A doc update sounds like an excellent idea.

zw


More information about the Gcc-bugs mailing list