bug-gnulib
[Top][All Lists]
Advanced

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

Re: GCC optimizes integer overflow: bug or feature?


From: Gerald Pfeifer
Subject: Re: GCC optimizes integer overflow: bug or feature?
Date: Mon, 1 Jan 2007 22:07:53 +0100 (CET)

On Tue, 19 Dec 2006, Ian Lance Taylor wrote:
> Here is a quick list of optimizations that mainline gcc performs which
> rely on the idea that signed overflow is undefined.  All the types
> are, of course, signed.  I made have made some mistakes.  I think this
> gives a good feel for the sorts of optimizations we can make with this
> assumption.

Thanks for compiling this exhaustive list, Ian!

Currently our documentation on -fwrapv is rather short and does not
provide examples or anything to provide such a feel:

  This option instructs the compiler to assume that signed arithmetic 
  overflow of addition, subtraction and multiplication wraps around
  using twos-complement representation.  This flag enables some 
  optimizations and disables others.  This option is enabled by default 
  for the Java front-end, as required by the Java language specification.

"This flag enables some optimizations and disables others" is all we
have.  I wonder whether you could perhaps add (part of) your list to
this documentation?  Or would that be too specific?

Gerald




reply via email to

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