smatch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Brandeburg, Jesse" <jesse.brandeburg@intel.com>
Cc: "smatch@vger.kernel.org" <smatch@vger.kernel.org>
Subject: Re: FW: [error27/smatch] smatch misidentifies uninitialized variable after switch with no default: (Issue #3)
Date: Mon, 10 Jan 2022 15:42:10 +0300	[thread overview]
Message-ID: <20220110124210.GC1978@kadam> (raw)
In-Reply-To: <CO1PR11MB4914FD7F8F25CA5988BDBE41974D9@CO1PR11MB4914.namprd11.prod.outlook.com>

Thanks for the bug report.  The ideal way to fix this would be to handle
it in Smatch core so that if called get_implied_rl(cmd, &rl) then it
would return 0-2.

Unfortunately, that's quite a bit of work to implement it properly...

For now, I'm just going to add a special case in check_uninitialized.c
to silence these warnings.  If you have a switch(some_enum) and there is
no default statement, then mark all the partially initialized variables
as fully initialized.

regards,
dan carpenter


      reply	other threads:[~2022-01-10 12:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <error27/smatch/issues/3@github.com>
2022-01-07 16:19 ` FW: [error27/smatch] smatch misidentifies uninitialized variable after switch with no default: (Issue #3) Brandeburg, Jesse
2022-01-10 12:42   ` 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=20220110124210.GC1978@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=jesse.brandeburg@intel.com \
    --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 read-only IMAP folder(s) and NNTP newsgroup(s).