autoconf-patches
[Top][All Lists]
Advanced

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

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


From: Vincent Lefevre
Subject: Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
Date: Mon, 1 Jan 2007 02:04:31 +0100
User-agent: Mutt/1.5.13-vl-r14963 (2006-12-20)

On 2006-12-31 11:37:21 -0500, Richard Kenner wrote:
> Certainly.  Indeed I think that's the whole point of this thread: that if
> you want to catch ALL potential optimizations opportunities given to you
> by the standard, you must assume that signed overflows are undefined.
> 
> However, what's being discussed is an engineering tradeoff where you give
> up SOME optimization opportunities to avoid breaking code.

I was responding to a particular point. You said a few messages ago:

| I can't speak for any other GCC developer, but I personally am quite
| comfortable viewing any code that assumes wrapping semantics as broken
| and needing fixing with the exception of these cases of checking for
| overflow: there simply is no good way in C to do these checks in a portable
| manner and, as I said, I think we should make sure they continue to work
| and maybe even document that.

Now:

> Essentially, there are three choices: with -fwrapv, you must preseve
> wrapping semantics and do NONE of those optimizations; with
> -fno-wrapv, you can do ALL of them; in the default cause, a
> heuristic can be used that attempts to balance optimization quality
> against breakage of old code.

This isn't just about old code. If you're saying that old code with
overflow checking can't be fixed (in a portable manner...), then new
code will probably use the same tricks. Then hoping that such code
will continue to work is not sufficient. You need to really make sure
that it will still work. This means that either "overflow checking"
must be clearly defined, or -fwrapv should be used in any case (thus
disabling all the possible optimizations based on overflows). Well,
there's another way: a GCC extension so that the programmer can say
when wrapping is assumed.

-- 
Vincent Lefèvre <address@hidden> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)




reply via email to

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