Re: New and bogus(!) warning produced by sparse.

From: Linus Torvalds
Date: Fri Sep 30 2005 - 09:35:30 EST




On Fri, 30 Sep 2005, Linus Torvalds wrote:
>
> I see why it happens, will fix sparse momentarily (btw, for sparse bugs,
> use "linux-sparse@xxxxxxxxxxxxxxx" rather than LKML - since this is
> clearly not a kernel problem ;)

Side note: it has nothing to do with bit-fields: it happens for any
structure member that sparse will have incorrectly figured out as having a
value pre-assigned to it. So even

struct {
int value;
} dummy = { 0 };

dummy.value = 1;

will generate the warning. It isn't that a bitfield cannot have it's
address taken, it's that sparse has incorrectly "optimized" dummy.value to
be 0, so it ends up evaluating it as

0 = 1;

and says that it's trying to assign a non-lvalue.. Very stupid.

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/