Skip to contentSkip to conversation

stumped... implicitly truncated warning mystery

KJ Jesse Millan 3 participants 4 messages Jul 6, 2005 Kernel janitors

lore
Share & tools
lore
#0 lore raw

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.

Signature · 12 lines
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
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
#1 lore raw
Quoted 11 lines · Jesse Millan

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

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw
In reply to Jesse Millan
Quoted 18 lines · Dave Jones
Quoted 11 lines · Jesse Millan

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;
Quoted 10 lines

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!

Signature · 12 lines
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
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
#3 lore raw
In reply to Jesse Millan
Quoted 8 lines · Jesse Millan

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
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors