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: Autoconf manual's coverage of signed integer overflow & portability


> 
> kenner@vlsi1.ultra.nyu.edu (Richard Kenner) writes:
> 
> >> >> Many portable C programs assume that signed integer overflow wraps around
> >> >> reliably using two's complement arithmetic.
> >> >
> >>
> >> I was looking for an adjective that mean the programs work on a wide
> >> variety of platforms, and "portable" seems more appropriate than
> >> "widely-used".
> >
> > Maybe just say what you mean, then:  "Many C programs that work on a wide
> > variety of platforms assume that ..."
> 
> That's too long!  I'll prepend an "In practice" instead.

What about this:
Old C programs that written against the C standard depend on signed
overflow being defined as wrapping.

And then reference the paper, "C traps and pitfalls" (which by the way
was written by the founder of ADL for C++).

I will post a patch to add a link to that paper to the GCC readings page
sometime tomorrow (http://gcc.gnu.org/readings.html).

I hope people learn from their mistakes in the past for depening on this
behavior and actually instead of changing GCC, people fix up their code.
I also hope programs written after 1989 don't depend on this behavior
and we can just declare as them as being broken.  If people when learning
C, don't really learn C, then their code is broken.  I hope people
don't come who don't know C, come to us to ask if we could change GCC
to do something which would hurt performance of their code, just because
they don't know the language they are writting in.  Now we can provide
options for them to allow them to work by making those options default
is wrong.  This is why I am agrueing against even changing VRP, as it
punishes people who don't depend on overflow being wrapping.  Ian's
change in fact punishes people's code who does not depend on that
as it is causes compile time slow down (and an increase of memory usage
inside GCC itself)  which people will complain about.

Thanks,
Andrew Pinski


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