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

[Bug c/14259] comparison is always true due to limited range of data type


------- 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


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