This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
-Wsign-compare makes gcc complain about bool?unsigned:signed
- From: Martin Str|mberg <ams at ludd dot luth dot se>
- To: gcc-bugs at gcc dot gnu dot org
- Cc: DJGPP-WORKERS <djgpp-workers at delorie dot com>
- Date: Sun, 17 Mar 2002 15:52:31 +0100 (CET)
- Subject: -Wsign-compare makes gcc complain about bool?unsigned:signed
gcc --version reports:
3.04
My platform is DJGPP (run in WINDOZE 98).
This program
#include <stdio.h>
int main(void)
{
unsigned int u;
int s;
unsigned long long ll = u?u:s;
printf("ll = %llu.\n", ll);
return( 0 );
}
compiled with "gcc -O2 -g -Wall c.c -o c -Wsign-compare" gives
c.c: In function `main':
c.c:8: warning: signed and unsigned type in conditional expression
c.c:5: warning: `u' might be used uninitialized in this function
c.c:6: warning: `s' might be used uninitialized in this function
I have no problem with line 5 and 6.
But line 8. Why is that wrong? And why does -Wsign-compare trigger
this warning when it's not a comparison?
Right,
MartinS