This is the mail archive of the gcc@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]

inapropriate 'comparison is always false due to limited range of data type' warning


Hello,

v857829@vdsdr-125 ~ $ gcc -O0 test.c -o test
test.c: In function 'main':
test.c:5: warning: comparison is always false due to limited range of data type


does not make sense to me in the following code:




#include <stdio.h>
int main (char *argv[], int argc) {
 unsigned short int number;

 for (number=0; number < ~(number&(~number)) ; number++) {
   printf("hello");
 }

 return 0;
}




i believe gcc is misinterpreting ~(number&(~number))


any coments, help welcome.


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