On Monday 17 August 2009 22:30:41 Pavel Roskin wrote:
> On Sat, 2009-08-15 at 12:04 +0200, Michael Buesch wrote:
> 
> > I still do not understand why it does complain about an _explicit_ 
> > truncation.
> > That's simply stupid. If I program an explicit truncation I _do_ mean to 
> > truncate the value.
> 
> Actually, it's a bug in sparse.  Sparse acts inconsistently.
> 
> This causes a warning:
> 
> void mask(unsigned short mask);
> static void test(void)
> {
>         mask((unsigned short)0xffff0000);
> }
> 
> test.c:4:30: warning: cast truncates bits from constant value (ffff0000
> becomes 0)
> 
> But this is OK:
> 
> void mask(unsigned short mask);
> static void test(void)
> {
>         mask((unsigned short)0xfffff000);
> }
> 
> Moreover, this is OK, even though the cast changes the value of the
> constant:
> 
> void mask(unsigned short mask);
> static void test(void)
> {
>         mask((unsigned short)0xfffff000U);
> }
> 
> I suggest that we take no action until sparse is fixed.  I'm going to
> report the issue to the sparse mailing list now.
> 

Cool, thanks a lot for tracking this down. :)

-- 
Greetings, Michael.
_______________________________________________
Bcm43xx-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev

Reply via email to