All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] stumped... implicitly truncated warning mystery
@ 2005-07-06 17:48 Jesse Millan
  2005-07-06 18:01 ` Dave Jones
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jesse Millan @ 2005-07-06 17:48 UTC (permalink / raw)
  To: kernel-janitors


Hey all,

GCC4.0.0 is giving me a warning that I cant seem to get rid of. In the
file drivers/net/wireless/wavelan_cs.c on lines 3607 and 3608 is the
following assignment:

cfblk.ifrm_spc = 0x20;
cfblk.slottim_low = 0x20;

where ifrm_spc and slottim_low are both of type unsigned char.

Compiling on a X86_64 emits the warning: large integer implicitly
truncated to unsigned type.

Explicitly casting 0x20 to unsigned char or u_char does not get rid of
the warning. Also, the warning starts at values 0x10 and above.

Any ideas/leads would be greatly appreciated.

-- 
Jesse Millan
CNS Unix Team
Portland State University
Phone: (503) 725-9151
Mobile: (503) 453-0748
GPG key: www.system-calls.com/gpg.php

grep --recursive --ignore-case 'SHOULD WORK' /usr/src/linux/* | wc
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] stumped... implicitly truncated warning mystery
  2005-07-06 17:48 [KJ] stumped... implicitly truncated warning mystery Jesse Millan
@ 2005-07-06 18:01 ` Dave Jones
  2005-07-06 18:03 ` Jesse Millan
  2005-07-06 18:24 ` Alexey Dobriyan
  2 siblings, 0 replies; 4+ messages in thread
From: Dave Jones @ 2005-07-06 18:01 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 608 bytes --]

On Wed, Jul 06, 2005 at 10:48:46AM -0700, Jesse Millan wrote:
 > 
 > Hey all,
 > 
 > GCC4.0.0 is giving me a warning that I cant seem to get rid of. In the
 > file drivers/net/wireless/wavelan_cs.c on lines 3607 and 3608 is the
 > following assignment:
 > 
 > cfblk.ifrm_spc = 0x20;
 > cfblk.slottim_low = 0x20;
 > 
 > where ifrm_spc and slottim_low are both of type unsigned char.

No, look again.  They are bitfields.

  u_char        : 4,
     ifrm_spc   : 4;

4 bits isn't enough space to encode 0x20 which is 0b100000

  u_char        : 5,
     slottim_low : 3;

Likewise, 3 bits is too small.

		Dave


[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] stumped... implicitly truncated warning mystery
  2005-07-06 17:48 [KJ] stumped... implicitly truncated warning mystery Jesse Millan
  2005-07-06 18:01 ` Dave Jones
@ 2005-07-06 18:03 ` Jesse Millan
  2005-07-06 18:24 ` Alexey Dobriyan
  2 siblings, 0 replies; 4+ messages in thread
From: Jesse Millan @ 2005-07-06 18:03 UTC (permalink / raw)
  To: kernel-janitors



Dave Jones wrote:
> On Wed, Jul 06, 2005 at 10:48:46AM -0700, Jesse Millan wrote:
>  > 
>  > Hey all,
>  > 
>  > GCC4.0.0 is giving me a warning that I cant seem to get rid of. In the
>  > file drivers/net/wireless/wavelan_cs.c on lines 3607 and 3608 is the
>  > following assignment:
>  > 
>  > cfblk.ifrm_spc = 0x20;
>  > cfblk.slottim_low = 0x20;
>  > 
>  > where ifrm_spc and slottim_low are both of type unsigned char.
> 
> No, look again.  They are bitfields.
> 
>   u_char        : 4,
>      ifrm_spc   : 4;
> 
> 4 bits isn't enough space to encode 0x20 which is 0b100000
> 
>   u_char        : 5,
>      slottim_low : 3;
> 
> Likewise, 3 bits is too small.
> 
> 		Dave
> 
> 

Thank you Dave!

-- 
Jesse Millan
CNS Unix Team
Portland State University
Phone: (503) 725-9151
Mobile: (503) 453-0748
GPG key: www.system-calls.com/gpg.php

grep --recursive --ignore-case 'SHOULD WORK' /usr/src/linux/* | wc
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] stumped... implicitly truncated warning mystery
  2005-07-06 17:48 [KJ] stumped... implicitly truncated warning mystery Jesse Millan
  2005-07-06 18:01 ` Dave Jones
  2005-07-06 18:03 ` Jesse Millan
@ 2005-07-06 18:24 ` Alexey Dobriyan
  2 siblings, 0 replies; 4+ messages in thread
From: Alexey Dobriyan @ 2005-07-06 18:24 UTC (permalink / raw)
  To: kernel-janitors

On Wednesday 06 July 2005 21:48, Jesse Millan wrote:
> GCC4.0.0 is giving me a warning that I cant seem to get rid of. In the
> file drivers/net/wireless/wavelan_cs.c on lines 3607 and 3608 is the
> following assignment:
> 
> cfblk.ifrm_spc = 0x20;
> cfblk.slottim_low = 0x20;
> 
> where ifrm_spc and slottim_low are both of type unsigned char.

They are bitfields.

drivers/net/wireless/i82593.h:

168	  u_char            : 4,
169	         ifrm_spc   : 4;
170	  u_char            : 5,
171	         slottim_low : 3;
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

end of thread, other threads:[~2005-07-06 18:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-06 17:48 [KJ] stumped... implicitly truncated warning mystery Jesse Millan
2005-07-06 18:01 ` Dave Jones
2005-07-06 18:03 ` Jesse Millan
2005-07-06 18:24 ` Alexey Dobriyan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.