http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56153
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |manu at gcc dot gnu.org --- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2013-01-30 19:11:19 UTC --- I always found the wording of the warning confusing. This is what clang says: test.c:12:46: warning: operand of ? changes signedness: 'int' to 'unsigned int' [-Wsign-conversion] fprintf (stdout, "%d", foo != 0 ? foo->num : -1); ~~~~~~~ ^~ And this is what GCC 4.8 says: /home/manuel/test.c:12:44: warning: signed and unsigned type in conditional expression [-Wsign-compare] fprintf (stdout, "%d", foo != 0 ? foo->num : -1); ^ Note also the different location information. Note the description of -Wsign-compare: "Warn when a comparison between signed and unsigned values could produce an incorrect result when the signed value is converted to unsigned. " which does not match this warning. It does match the description of -Wsign-conversion: "Warn for implicit conversions that may change the sign of an integer value, like assigning a signed integer expression to an unsigned integer variable." When using -Wsign-conversion, GCC emits an additional warning: /home/manuel/test.c:12:1: warning: negative integer implicitly converted to unsigned type [-Wsign-conversion] fprintf (stdout, "%d", foo != 0 ? foo->num : -1); ^ (with awful location info).