Re: [wireless-next:master 70/102] drivers/net/wireless/b43/phy_ht.c:338:35: sparse: cast truncates bits from constant value (ffff3fff becomes 3fff)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 16, 2014 at 10:17:18AM +0800, Fengguang Wu wrote:
> I could disable this warning in my reports, but CC sparse authors
> first to check if there are more elegant solutions.

int main(void)
{
        printf("%x\n", (unsigned short)~(0xc00));   // <-- ok
        printf("%x\n", (unsigned short)~(0xc000));  // <-- complains

        return 0;
}

test.c:10:40: warning: cast truncates bits from constant value (ffff3fff becomes 3fff)

The reason the first one is ok is because we don't complain if the
truncated bits are purely sign bits.  I feel like it should apply to the
second statement as well.  If we're only masking out 0xffff then don't
complain.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux