bug-gnulib
[Top][All Lists]
Advanced

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

Re: [bug-gnulib] GCC optimizes integer overflow: bug or feature?


From: Bruno Haible
Subject: Re: [bug-gnulib] GCC optimizes integer overflow: bug or feature?
Date: Tue, 19 Dec 2006 22:49:32 +0100
User-agent: KMail/1.9.1

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




reply via email to

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