__builtin_return_address

Zack Weinberg zackw@stanford.edu
Tue Oct 31 19:40:00 GMT 2000


On Tue, Oct 31, 2000 at 10:18:21PM -0500, Matt Newcomb wrote:
> G'day,
> 
> It is my interpretation that if you call
> __builtin_return_address with position in the call stack
> higher than the top of the call stack then it should
> return 0.  I've been told by several people that this is
> supposed to happen and have seen at least three
> debugging/profiling packages that make this assumption. 

1) main is not the top of the call stack.  
2) You cannot rely on __builtin_return_address to return any
meaningful information whatsoever except when its argument is zero.

HTH.

zw


More information about the Gcc-bugs mailing list