This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

__builtin_return_address (0) and inlining


Currently if you use __builtin_return_address (0) in a function that is
inlined you'll likely get the wrong answer. I think I remember a
conversation a while back about this, but I couldn't seem to find it.

Now, unfortunately the docs don't say a whole lot on the subject, just
that for N > 0, __builtin_return_address should only be used for
debugging purposes. I've taken a look at the code and it should be
pretty easy to make __builtin_return_address work if we turn off
inlining for those functions. Similar to the #if 0'd work in
c-objc-common.c:96.  Otherwise we should probably mention this in the
docs. I'll work up a patch either way, I'd just like to see what the
"correct" behavior should be.

-eric

-- 
I will not carve gods


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]