From: Dan Carpenter <dan.carpenter@oracle.com>
To: Fengguang Wu <fengguang.wu@intel.com>
Cc: "Rafał Miłecki" <zajec5@gmail.com>,
"John W. Linville" <linville@tuxdriver.com>,
kbuild-all@01.org, "Christopher Li" <sparse@chrisli.org>,
Linux-Sparse <linux-sparse@vger.kernel.org>
Subject: 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: Tue, 16 Sep 2014 10:20:35 +0300 [thread overview]
Message-ID: <20140916072035.GG17875@mwanda> (raw)
In-Reply-To: <20140916021718.GB16455@localhost>
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
prev parent reply other threads:[~2014-09-16 7:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <541742fe.FxHiltLcSOUDGDDj%fengguang.wu@intel.com>
[not found] ` <CACna6ryGg4NY2ecDjCKckXk8QXSJWVpbWWtdya9JRB618G92wQ@mail.gmail.com>
2014-09-16 2:17 ` [wireless-next:master 70/102] drivers/net/wireless/b43/phy_ht.c:338:35: sparse: cast truncates bits from constant value (ffff3fff becomes 3fff) Fengguang Wu
2014-09-16 7:20 ` Dan Carpenter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140916072035.GG17875@mwanda \
--to=dan.carpenter@oracle.com \
--cc=fengguang.wu@intel.com \
--cc=kbuild-all@01.org \
--cc=linux-sparse@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=sparse@chrisli.org \
--cc=zajec5@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).