This is the mail archive of the gcc@gcc.gnu.org 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: [bug-gnulib] GCC optimizes integer overflow: bug or feature?


Paul Eggert wrote:
> Compiling everything with -fwrapv is simple.  It has
> optimization drawbacks, but if that's the best we can do
> now, then we'll probably do it.  And once we do it, human
> nature suggests that we will generally not bother with the
> painstaking analysis needed to omit -fwrapv.

Certainly noone will try to analyze megabytes of source code in order to
someday be able to omit -fwrapv from the CFLAGS.

But if GCC would give a warning every time it does these optimizations which
are OK according to C99 but break LIA-1 assumptions, it would be manageable.
This way, programmers would have a chance to use 'unsigned int' instead of
'int' in those few places where it matters.

Such a warning should be simple to implement: Everywhere you use the value
of 'flag_wrapv' in a way that matters, give a warning. No?

Bruno


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