[Bug c++/59928] New: Possible incorrect warning "comparison is always false due to limited range of data type"
igtrnt at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Jan 23 20:52:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59928
Bug ID: 59928
Summary: Possible incorrect warning "comparison is always false
due to limited range of data type"
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: igtrnt at gmail dot com
The code below produces the following warning:
comparison is always false due to limited range of data type [-Wtype-limits]
CODE:
bool b;
if ( static_cast<unsigned int>(b) > static_cast<unsigned int>(1) )
{
// DO SMTH.
}
In case boolean variable is uninitialized, comparison may be true because
integer value of `b` may contain junk and not neceserally `0` or `1`.
More information about the Gcc-bugs
mailing list