[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: warning: comparison is always false due to limited range of data typ
Re: warning: comparison is always false due to limited range of data type
Wed, 22 Jun 2005 14:06:58 +0200
Oskar Liljeblad <address@hidden> wrote:
> On Wednesday, June 22, 2005 at 13:47, Jim Meyering wrote:
>> > I get that warning without both -W and -Wall, I think.
>> > (gcc 3.3.6)
>> I've tried with the following versions of gcc on x86_64-unknown-linux-gnu:
>> gcc-3.3 (GCC) 3.3.6 (Debian 1:3.3.6-6)
>> gcc-3.4 (GCC) 3.4.5 20050605 (prerelease) (Debian 3.4.4-0)
>> gcc-4.0 (GCC) 4.0.1 20050522 (prerelease) (Debian 4.0.0-9)
>> and see that warning only with -W.
> Strange! Is -W somehow turned on by default?
> $ gcc -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -c quotearg.c
> quotearg.c: In function `quotearg_n_options':
> quotearg.c:586: warning: comparison is always false due to limited range of
> data type
No. It was my fault.
I'd changed it to size_t, then (mistakenly) back to `int'
rather than to `unsigned int'.
Now, I too see this warning, even without any -W* or -O option:
$ gcc-3.3 -DHAVE_CONFIG_H -I. -I.. -g -c quotearg.c
quotearg.c: In function `quotearg_n_options':
quotearg.c:586: warning: comparison is always false due to limited range of
Sorry about the mix-up.
I've just confirmed that this warning (from gcc/c-common.c)
does not appear to be associated with any command line option.