Linux SPARSE checker discussions
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: linux-sparse <linux-sparse@vger.kernel.org>
Cc: Michael Wu <flamingice@sourmilk.net>,
	Christoph Hellwig <hch@infradead.org>
Subject: sparse missing bitwise warnings with dubious bitfields
Date: Fri, 08 Jun 2007 10:24:10 +0200	[thread overview]
Message-ID: <1181291050.6533.19.camel@johannes.berg> (raw)

[-- Attachment #1: Type: text/plain, Size: 689 bytes --]

Hi,

Not sure if this is intended but it is surely quite weird. Take the
following code:

--- begin code ---
#ifdef DUBIOUS
struct {  
  int x:1;
};
#endif

typedef unsigned short __attribute__((bitwise)) __le32;

int main(int argc, char **argv)
{
  __le32 i = 5;
}
--- end code ---

and save it as test.c, and then observe:

$ sparse test.c
test.c:11:14: warning: incorrect type in initializer (different base types)
test.c:11:14:    expected restricted unsigned short [usertype] i
test.c:11:14:    got int 

$ sparse test.c -DDUBIOUS
test.c:3:10: error: dubious one-bit signed bitfield

[note that no warning about the bitwise error is there!]

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

             reply	other threads:[~2007-06-08  8:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-08  8:24 Johannes Berg [this message]
2007-06-08 13:19 ` sparse missing bitwise warnings with dubious bitfields Al Viro

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=1181291050.6533.19.camel@johannes.berg \
    --to=johannes@sipsolutions.net \
    --cc=flamingice@sourmilk.net \
    --cc=hch@infradead.org \
    --cc=linux-sparse@vger.kernel.org \
    /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