[Bug c/59953] New: Improve the warning message for unsigned_expression >= 0UL
chengniansun at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Jan 27 09:30:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59953
Bug ID: 59953
Summary: Improve the warning message for unsigned_expression >=
0UL
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: chengniansun at gmail dot com
-Wtype-limits emits different messages for "unsigned_expression >= 0" and
"unsigned_expression >= 0UL". It would be nice if you could make the messages
more consistent. Moreover, the warning message for "unsigned_expression >= 0"
is more informative than the other.
$: cat type-limit-improve.c
extern unsigned g();
void f(unsigned u, unsigned long ul) {
int b = g() >= 0;
int c = g() >= 0UL;
}
$: gcc-trunk -c -Wtype-limits type-limit-improve.c
type-limit-improve.c: In function ‘f’:
type-limit-improve.c:3:12: warning: comparison of unsigned expression >= 0 is
always true [-Wtype-limits]
int b = g() >= 0;
^
type-limit-improve.c:4:12: warning: comparison is always true due to limited
range of data type [-Wtype-limits]
int c = g() >= 0UL;
^
$: gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/home/chengniansun/tools/gcc-trunk-binaries/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --enable-languages=c,c++
--disable-multilib --prefix=/home/chengniansun/tools/gcc-trunk-binaries :
(reconfigured) ../gcc-trunk/configure --enable-languages=c,c++
--disable-multilib --prefix=/home/chengniansun/tools/gcc-trunk-binaries
Thread model: posix
gcc version 4.9.0 20140123 (experimental) (GCC)
More information about the Gcc-bugs
mailing list