On Tue, 19 Dec 2006, Bruno Haible wrote: > 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
Sounds like the -Wstrict-aliasing flag, which was a reasonable aid for the analogous problem with -fstrict-aliasing. There's only 39 places in gcc where flag_wrapv is used. Perhaps not even all of them require the warning. Or at least not all of them necessarily have to be in the first go around. Care to submit a patch? --Kaveh -- Kaveh R. Ghazi [EMAIL PROTECTED]