linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: Michael Buesch <mb@bu3sch.de>
Cc: "Gábor Stefanik" <netrolller.3d@gmail.com>,
	linux-wireless@vger.kernel.org, bcm43xx-dev@lists.berlios.de,
	"Larry Finger" <Larry.Finger@lwfinger.net>
Subject: Re: [PATCH] b43: Fix sparse warnings
Date: Mon, 17 Aug 2009 16:30:41 -0400	[thread overview]
Message-ID: <1250541041.10511.10.camel@mj> (raw)
In-Reply-To: <200908151204.11024.mb@bu3sch.de>

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.

-- 
Regards,
Pavel Roskin

  reply	other threads:[~2009-08-17 20:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-13 22:15 [PATCH] b43: Fix sparse warnings Larry Finger
2009-08-14 20:15 ` Michael Buesch
2009-08-14 20:52   ` Pavel Roskin
2009-08-14 21:00     ` Michael Buesch
2009-08-14 21:04       ` Gábor Stefanik
2009-08-14 21:35         ` Pavel Roskin
2009-08-15 10:04           ` Michael Buesch
2009-08-17 20:30             ` Pavel Roskin [this message]
2009-08-18 13:12               ` Michael Buesch
2009-08-14 21:29       ` Pavel Roskin
2009-08-14 21:46         ` Pavel Roskin
2009-08-15 10:08           ` Michael Buesch
2009-08-14 21:33   ` Larry Finger
  -- strict thread matches above, loose matches on Subject: below --
2007-09-19 16:30 Michael Buesch

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=1250541041.10511.10.camel@mj \
    --to=proski@gnu.org \
    --cc=Larry.Finger@lwfinger.net \
    --cc=bcm43xx-dev@lists.berlios.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mb@bu3sch.de \
    --cc=netrolller.3d@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).