http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60036
Bug ID: 60036 Summary: Spurious signedness conversion warning with relational operator 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 Gcc-trunk emits a signedness conversion warning for the statement "f ^= fn1() > a;". However, as the value of "fn1() > a" is either 1 or 0, the warning is not true. Moreover, Gcc-4.8 and 4.7 do not output this warning. And if I change the statement to "f = f ^ (fn1() > a);", gcc-trunk does not emit this warning, either. $: cat conversion-for-boolean.c extern int fn1(); unsigned fn(int a) { unsigned f = 9; f ^= fn1() > a; return f; } $: gcc-trunk -c -Wconversion -std=c11 conversion-for-boolean.c conversion-for-boolean.c: In function ‘fn’: conversion-for-boolean.c:4:5: warning: conversion to ‘unsigned int’ from ‘int’ may change the sign of the result [-Wsign-conversion] f ^= fn1() > a; ^ $: gcc-4.8 -c -Wconversion -std=c11 conversion-for-boolean.c $: gcc-4.7 -c -Wconversion -std=c11 conversion-for-boolean.c $: gcc-trunk --version gcc-trunk (GCC) 4.9.0 20140131 (experimental) Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.