linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Warnings building 2.4.22rc2 with gcc 3.3
@ 2003-08-11  8:54 Alex Davis
  2003-08-11 15:50 ` Willy Tarreau
  0 siblings, 1 reply; 4+ messages in thread
From: Alex Davis @ 2003-08-11  8:54 UTC (permalink / raw)
  To: linux-kernel

When I build 2.4.22rc2 with gcc 3.3, I get the following warnings


vt.c:166: warning: comparison is always false due to limited range of data type
vt.c:283: warning: comparison is always false due to limited range of data type
keyboard.c:644: warning: comparison is always true due to limited range of data type

It seems an unsigned char is being compared with 256, which always returns false.

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Warnings building 2.4.22rc2 with gcc 3.3
  2003-08-11  8:54 Warnings building 2.4.22rc2 with gcc 3.3 Alex Davis
@ 2003-08-11 15:50 ` Willy Tarreau
  2003-08-11 16:59   ` Luiz Capitulino
  0 siblings, 1 reply; 4+ messages in thread
From: Willy Tarreau @ 2003-08-11 15:50 UTC (permalink / raw)
  To: Alex Davis; +Cc: linux-kernel

On Mon, Aug 11, 2003 at 01:54:53AM -0700, Alex Davis wrote:
> When I build 2.4.22rc2 with gcc 3.3, I get the following warnings
> 
> 
> vt.c:166: warning: comparison is always false due to limited range of data type
> vt.c:283: warning: comparison is always false due to limited range of data type
> keyboard.c:644: warning: comparison is always true due to limited range of data type
> 
> It seems an unsigned char is being compared with 256, which always returns false.

For keyboard.c, the test is :

        if (value < SIZE(func_table)) {

so it's reassuring that any value is contained in the table. We could hide
the warning with a cast of value to (int).

for vt.c, it's the same concept, some bounds are enforced on some values, and
in the event they would be violated, -EINVAL would be returned. So the check,
even if useless here, has some sense. Here again, a cast could hide the
warnings, but may generate useless code.

Cheers,
Willy


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Warnings building 2.4.22rc2 with gcc 3.3
  2003-08-11 15:50 ` Willy Tarreau
@ 2003-08-11 16:59   ` Luiz Capitulino
  0 siblings, 0 replies; 4+ messages in thread
From: Luiz Capitulino @ 2003-08-11 16:59 UTC (permalink / raw)
  To: Willy Tarreau; +Cc: Alex Davis, linux-kernel

Willy,

Em Seg, 2003-08-11 às 12:50, Willy Tarreau escreveu:
> On Mon, Aug 11, 2003 at 01:54:53AM -0700, Alex Davis wrote:
> > When I build 2.4.22rc2 with gcc 3.3, I get the following warnings
> > 
> > 
> > vt.c:166: warning: comparison is always false due to limited range of data type
> > vt.c:283: warning: comparison is always false due to limited range of data type
> > keyboard.c:644: warning: comparison is always true due to limited range of data type
> > 
> > It seems an unsigned char is being compared with 256, which always returns false.
> 
> For keyboard.c, the test is :
> 
>         if (value < SIZE(func_table)) {
> 
> so it's reassuring that any value is contained in the table. We could hide
> the warning with a cast of value to (int).

 I'm getting it in 2.6.0-test3(-mm1) too. The problem (I think) is 
that the ''if'' is aways true because ''value'' never will be > than
''SIZE(func_table)''.
 
 The cast does not solve the problem, because ''value'' have just
8 bits (unsigned char) used, in other words, with the cast
the ''if'' will continue to be true.

-- 
Luiz Fernando N. Capitulino

<lcapitulino@prefeitura.sp.gov.br>
<http://www.telecentros.sp.gov.br>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Warnings building 2.4.22rc2 with gcc 3.3
@ 2003-08-11 15:26 Alex Davis
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Davis @ 2003-08-11 15:26 UTC (permalink / raw)
  To: linux-kernel

Any ideas?

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-08-11 17:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-11  8:54 Warnings building 2.4.22rc2 with gcc 3.3 Alex Davis
2003-08-11 15:50 ` Willy Tarreau
2003-08-11 16:59   ` Luiz Capitulino
2003-08-11 15:26 Alex Davis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).