Hello

Gcc 3.4.2 on WinXP seems to generate a warning that it should not.

$ gcc -v
Reading specs from C:/msys/mingw/bin/../lib/gcc/mingw32/3.4.2/specs
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-synchronization --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.2 (mingw-special)


The following C code shows the problem.

int foo() {
   long long val1 = 1; /* No warn when val1 is a long long */
   int c1 = (
         ((long long) val1) <
         ((long long)(-2147483647L - 1))
        );
   long val2 = 1; /* incorrect warn when val2 is a long */
   int c2 = (
         ((long long) val2) <
         ((long long)(-2147483647L - 1))
        );
   return (c1 || c2);
}

$ gcc -c test.c
test.c: In function `foo':
test.c:11: warning: comparison is always false due to limited range of data type

Both of the tests in the code above should compile without a warning, but the second one does not.

thanks much
Mo DeJong

Reply via email to