[Bug c/59939] New: No warning on signedness changes caused by implicit conversion
chengniansun at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Jan 25 00:29:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59939
Bug ID: 59939
Summary: No warning on signedness changes caused by implicit
conversion
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: chengniansun at gmail dot com
There is no warning on signedness changes by implicit conversion, which occur
in dead code due to short-circuit of "or". See the following. If I change "1 ||
fn1(a, b)" to "0 || fn1(a, b)", then Gcc warns.
--------------------------------------------------
$: cat s.c.v6.c
int a, b;
int fn1(unsigned, unsigned);
unsigned int fn2() {
return 1 || fn1(a, b);
}
$: gcc-trunk -c -Wconversion s.c.v6.c
$: clang-trunk -c -Wconversion s.c.v6.c
s.c.v6.c:5:19: warning: implicit conversion changes signedness: 'int' to
'unsigned int' [-Wsign-conversion]
return 1 || fn1(a, b);
~~~ ^
s.c.v6.c:5:22: warning: implicit conversion changes signedness: 'int' to
'unsigned int' [-Wsign-conversion]
return 1 || fn1(a, b);
~~~ ^
2 warnings generated.
-----------------------------------------------------
Is it a better way to report that the "fn1(a,b)" is not reachable and there are
signedness changes in this function call, just like the way Clang does, or at
least one of them?
More information about the Gcc-bugs
mailing list