------- Additional Comments From eddy at opera dot com 2005-08-25 11:19 ------- Subject: Re: receiving result from __builtin_return_address() beyond stack top causes segfault
> This is just a doc problem really. If it is "just a doc problem" then the doc needs to change to say: __builtin_return_address(0) returns the address to which the current function will return; __builtin_return_address(1+n) may crash but if you're lucky it'll give the address to which the function indicated by __builtin_return_address(n) will return. This function is only provided for debug purposes. but I'm deeply skeptical. The function should either *not* take a parameter (how far up the stack to look) or *not* crash when that parameter is supplied or have some predictable way of knowing what values to not pass as parameter if you don't want to crash. Since the pattern of calls that doesn't crash (i.e. my work-around, see earlier notes on this bug) depends on hardware architecture, this means the code needs to change, even if the documentation is changed. Eddy. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8743