[Bug c/37591] suppress "signed and unsigned" warnings when signed value known to be positive

daniel.marjamaki at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Jul 6 08:59:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37591

Daniel Marjamäki <daniel.marjamaki at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.marjamaki at gmail dot com

--- Comment #7 from Daniel Marjamäki <daniel.marjamaki at gmail dot com> ---
+1

This is very annoying.

My code is:

unsigned int dostuff();
void f(int x) {
  if (x >= 0 && x < dostuff()) {}
}

This kind of false positive is indirectly a security problem. People routinely
hide these false positives using casts or changed variable types etc. and that
cause bugs and hides other real warnings.

I'd vote for either removing this warning or fixing it.


More information about the Gcc-bugs mailing list