This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/14259] comparison is always true due to limited range of data type
- From: "neil at daikokuya dot co dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Feb 2004 15:12:23 -0000
- Subject: [Bug c/14259] comparison is always true due to limited range of data type
- References: <20040223135722.14259.hans.buchmann@fhso.ch>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From neil at daikokuya dot co dot uk 2004-02-23 15:12 -------
Subject: Re: comparison is always true due to limited range of data type
hans dot buchmann at fhso dot ch wrote:-
>
> ------- Additional Comments From hans dot buchmann at fhso dot ch 2004-02-23 14:33 -------
> (In reply to comment #2)
> > (In reply to comment #1)
> > > The warning seems correct to me, since char is unsigned on arm.
> > even if char is unsigned
> > foo('\n') should return 0 and foo('A') should return 1
>
> sorry: of course vice versa
But the compiler is not saying the function always returns the
same thing. It is saying that a comparison is always true,
which is the case for the comparison on the left hand side of
the && expression.
The warning would be clearer if there were a caret pointing
to the comparison in question, but GCC does not yet do caret
diagnostics.
Neil.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14259