This is the mail archive of the 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: gcc trunk vs python

Jack Howarth wrote:
   Would any of the gcc developers care to drop by the python-dev
mailing list and give the author of python an answer?

*Guido van Rossum wrote:
I'm not sure I follow why this isn't considered a regression in GCC.
Clearly, on all current hardware, x == -x is also true for the most
negative int (0x80000000 on a 32-bit box). Why is GCC attempting to
break our code (and then blaming us for it!) by using the C standard's
weaselwords that signed integer overflow is undefined, despite that it
has had a traditional meaning on 2's complement hardware for many
decades? If GCC starts to enforce everything that the C standard says
is undefined then very few programs will still work...
First, you can always use -fwarpv and retail old behavior. Any code that breaks
or suspects breakage by the new behavior may use this flag.

Second, consider the following example:
Once upon a time

   int *p; /* No init!!! */
   if (*p && 0)   *p=0;

would not crash (DOS days). One could say
 "Why should Microsoft or Borland crash our code? Clearly, the
 value of "p" should never be read or written".
This example broke when we had memory protection. Memory
protection is a good thing, right?
Similarly, the new gcc behavior allows for better optimization.
Also, we are told that some boxes,  have different codes for signed
and unsigned operations, where signed overflows either trap
or saturate (IIRC on x86, MMX saturates on overflow)

Once I had a similar claim to yours (against this overflow behavior):
But after extensive searches, I could not find code that breaks due
to this new behavior of overflow. Such code is apparently rare.


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