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]

Re: Merging calls to `abort'


    Otherwise, we need to consider the merits of disabling an optimization 
    to make debugging easier.

Optimizing calls to `abort' doesn't offer much benefit, so I think in
this particular case it is worth disabling cross-jumping.

      This is a difficult choice to make, but at 
    -O2, I'd prefer that we optimize, and suggest other debugging techniques 
    intead of relying on the line numbers of abort calls.

The sole purpose of optimization is to satisfy users more.  If the
result of this optimization in this particular case is that users are
dissatisfied, GCC should adapt to the users, not vice versa.
To say to the users, "GCC doesn't do what you want if you write X,
so write Y instead", is distinctly inferior to changing GCC so it
does what you want if you write X.

Steven Bosscher <stevenb@suse.de> wrote:

    system.h:#define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__)

    where fancy_abort is a, well, fancy abort that prints some more
    information about what happened, and where.  IMVHO any moderately
    large piece of software that uses abort should consider using this
    kind of construct, or use assert.

Look at the irony of this recommendation.

This technique will work, but it is rather wasteful.  Each abort call,
if handled this way, requires two string constants that are redundant
with the program's debugging info.  It also requires the user to
change the program, which is a further inconvenience.

What's the point of cross-jumping?  It saves a certain amount of
space; it has no other benefit.  All else being equal, there's no
reason not to do it.  But cross-jumping abort calls interferes with
debugging.  That's a good reason not to do it.

But you recommend a different solution to this problem: changing all
the abort calls so that (1) they can't be cross-jumped and (2) they
use even more space.  If everyone follows your recommendation, not
only will no abort calls ever be cross jumped, but the net result will
be to make the compiled program even bigger than it would have been.
This makes no sense.

So please let's get rid of this optimization.  Those who want to use a
fancy_abort function will still be able to do so, but this change will
be an improvement for the rest.


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