This is the mail archive of the
mailing list for the GCC project.
Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
- From: Vincent Lefevre <vincent+gcc at vinc17 dot org>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: autoconf-patches at gnu dot org, bug-gnulib at gnu dot org, dewar at adacore dot com, eggert at cs dot ucla dot edu, gcc at gcc dot gnu dot org
- Date: Mon, 1 Jan 2007 02:04:31 +0100
- Subject: Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
- References: <10612302258.AA24598@vlsi1.ultra.nyu.edu> <email@example.com> <10612310029.AA28910@vlsi1.ultra.nyu.edu> <firstname.lastname@example.org> <20061231112419.GR32297@ay.vinc17.org> <10612311403.AA19198@vlsi1.ultra.nyu.edu> <20061231143915.GV32297@ay.vinc17.org> <10612311508.AA23381@vlsi1.ultra.nyu.edu> <20061231155917.GZ32297@ay.vinc17.org> <10612311637.AA27185@vlsi1.ultra.nyu.edu>
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.
> 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 <email@example.com> - 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)