linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: smatch@vger.kernel.org, linux-sparse@vger.kernel.org
Subject: Re: A smatch warning I dont understand in drivers/hwmon/max16065.c
Date: Tue, 6 Aug 2013 10:31:05 +0300	[thread overview]
Message-ID: <20130806073105.GP5102@mwanda> (raw)
In-Reply-To: <52002080.1070701@roeck-us.net>

On Mon, Aug 05, 2013 at 03:00:32PM -0700, Guenter Roeck wrote:
> Hi all,
> 
> I get the following warning while scanning drivers/hwmon/max16065.c.
> 
> drivers/hwmon/max16065.c:67:10: warning: Initializer entry defined twice
> drivers/hwmon/max16065.c:68:10:   also defined here
> drivers/hwmon/max16065.c:76:10: warning: Initializer entry defined twice
> drivers/hwmon/max16065.c:77:10:   also defined here
> 
> I must have looked at the code half a dozen times, but I just
> don't see what might be wrong.
> 
> Any idea, anyone ?

This is actually a Sparse warning not a Smatch warning.  To get the
Smatch warnings (there aren't any) do:
~/path/to/smatch/smatch_scripts/kchecker --spammy drivers/hwmon/max16065.c

This problem is here is a bug in Sparse handling arrays of _Bool.
Let me add the Sparse people to the CC list and a small test case.

static _Bool array_name[] = {
	[0] = 0,
	[1] = 0,
	[2] = 0,
	[3] = 0,
};

Sparse complains that element 1 was already initialized.

regards,
dan carpenter


       reply	other threads:[~2013-08-06  7:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <52002080.1070701@roeck-us.net>
2013-08-06  7:31 ` Dan Carpenter [this message]
2013-08-06 14:53   ` A sparse warning I dont understand in drivers/hwmon/max16065.c [was: smatch warning] Guenter Roeck

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=20130806073105.GP5102@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=smatch@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;
as well as URLs for NNTP newsgroup(s).