This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: __builtin_return_address (0) and inlining
>>>>> "Eric" == Eric Christopher <echristo@redhat.com> writes:
Eric> 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.
>>
Eric> I'd agree with this. I think that this behavior would be
Eric> unexpected.
Perhaps, but it could be documented as such, and at least it's then a
meaningful value.
One use for __builtin_return_address() is to print a stack trace for
debugging. A reasonable expectation is that printing
__builtin_return_address(i) for i = 0..n will produce the same
sequence of information as "bt" in gdb would show. And I think that's
what the proposal will do.
paul