PATCH RFC: -Wstrict-overflow, take 2

Ian Lance Taylor iant@google.com
Fri Feb 9 15:21:00 GMT 2007


"Richard Guenther" <richard.guenther@gmail.com> writes:

> Are levels 4 and 5 useful at all?  I wonder what would be a good level
> to turn on (apart from -Wall) for a distributor builting random packages.
> Did you try building emacs? ;)

I think it is much easier to tell users "you can test for all cases
where the compiler assumes that signed overflow will not occur" than
it is to say "you can test for all cases except for the ones we think
you shouldn't worry about."  The levels (which I think were Mark's
idea) give people the flexibility to test for the issues which are
likely to matter.  People who get really worked up about this will use
-fwrapv, thus avoiding the entire issue.

I haven't tried building any package other than gcc with these
warnings.


> Does -Wstrict-overflow=3 -Werror=strict-overflow=1 work?

I doubt it.

> Hopefully
> at least -Wno-error=strict-overflow does.

I expect so.

Let's deal with these details in a follow-up patch if they seem
useful.


>   integer_onep (tem)

Whoops, thanks.  Fixed.

Ian



More information about the Gcc-patches mailing list