[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."

From: Joe Buck
Subject: Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
Date: Mon, 1 Jan 2007 11:32:56 -0800
User-agent: Mutt/1.4.1i

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]