__builtin_return_address

Eli Zaretskii eliz@delorie.com
Thu Nov 2 02:33:00 GMT 2000


>   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?


More information about the Gcc-bugs mailing list