unsigned comparison warning
Hariharan
hariharans@picochip.com
Wed Jul 30 16:52:00 GMT 2008
Thanks Ian. I will raise this in gcc-help mailing list.
Cheers
Hari
Ian Lance Taylor wrote:
> Hariharan <hariharans@picochip.com> writes:
>
>> I found something rather strange with the unsigned comparison warnings
>> in GCC.
>
> This is the wrong mailing list. The mailing list gcc@gcc.gnu.org is
> for gcc developers. The mailing list gcc-help@gcc.gnu.org is for
> questions about using gcc. Please take any followups to
> gcc-help@gcc.gnu.org. Thanks.
>
>
>> and i did gcc -O2 -c trial.c, then i get a warning
>>
>> trial.c:6: warning: comparison is always true due to limited range of data type
>>
>> It works the same way if i used an unsigned short. But, if i use
>> unsigned int/long, i dont get this warning. This is on x86. Is there
>> an explanation for this?
>
> You neglected to mention the version of gcc. In current gcc, I don't
> see any warning when using "gcc -O2 -c trial.c". I see a warning for
> both "unsigned char" and "unsigned int" when I add the -Wextra option.
>
> Ian
More information about the Gcc
mailing list