This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

-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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]