On Mar 14, 2005, Eric Christopher <[EMAIL PROTECTED]> wrote:

>> > Now, I wouldn't object to hacking GCC to avoid cross-jumping calls to
>> > abort.  It's just that I don't think that the common GNU use of abort
>> > serves the users.
>> Agreed.  And as someone suggested, rather than treating abort
>> specially within GCC, I think we'd be better off with a function
>> attribute which prevented cross jumping to any function with
>> the attribute set.

> I think it makes sense to just not crossjump noreturn attribute
> functions if we're going to do this.

I think this is a slippery slope.  Crossjumping calls to abort(), or
even arbitrary noreturn functions, is just yet another technique of
compiler optimization that makes debugging more difficult.
Crossjumping calls to returning functions can be just as confusing if
you're looking at a backtrace in a debugger, especially if a function
gets called from lots of different functions that all get inlined into
one that ends up being identified as the frame owner, and if they get
cross-jumped, things get very confusing.

Then, there's sibcalling, that can also contribute for more confusing
backtraces.

To sum up my point: I don't think avoiding crossjumping of calls to
abort will address the underlying issue, which is that backtraces
obtained from optimized programs may surprise people.  Such avoidance
will only paper over the issue, making the compiler behavior less
consistent and thus even more confusing.  If people want accurate
stack traces, they shouldn't be using optimizations that can mess with
backtraces.

What we might want to do is provide an option to disable all such
optimizations.

-- 
Alexandre Oliva             http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   [EMAIL PROTECTED], gcc.gnu.org}
Free Software Evangelist  [EMAIL PROTECTED], gnu.org}

Reply via email to