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: changing "configure" to default to "gcc -g -O2 -fwrapv ..."

On Mon, Jan 01, 2007 at 10:24:36AM -0800, Andrew Pinski wrote:
> Then the question is why does C developers act differently than Fortran
> developers when it comes to undefinedness?

In the case of int overflow wrapping, I think it's because the Bell Labs
folks appeared to assume wrapping semantics from Day One in all their
code.  This meant that no one could write a C compiler that trapped int
overflows, or Unix wouldn't work.

There's a concept in Anglo-American law called an easement, which
basically means that if a property owner allows a use of his/her property
for many years, to the point where the surrounding community counts on it,
the owner cannot suddenly forbid the use (other countries have different
mechanisms to support "pass through rights", and the US has gotten more
"propertarian" in recent years, but the point remains).  So, it appears
that there is a nearly 20 year old easement in C, much as I dislike saying

That said, we don't want to cripple loop optimization.  So this raises
the question of whether there is some rule or heuristic that can be used
that will allow loop optimization to assume that there is no overflow,
while not breaking the uses that we see in programs like gcc.

An alternative path is to try to get rid of the easement, by helping
everyone fix their code.  We'd have to see just how bad the problem is.
One way is to build distros with trapping integer arithmetic and see what
breaks, though that won't find all errors.


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