linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>,
	Ramsay Jones <ramsay@ramsayjones.plus.com>
Subject: [PATCH] gensel: remove unneeded test/uninitialized warning
Date: Tue, 23 Jun 2020 00:38:54 +0200	[thread overview]
Message-ID: <20200622223854.87802-1-luc.vanoostenryck@gmail.com> (raw)
Message-ID: <20200622223854.Yhubpa68MicfkfWKfPmfv0HhiS6MZpKXStxlkZ88lbs@z> (raw)

When evaluation generic selections, it is tested if the type in
the selection is a SYM_NODE or not, but:
* all these are SYM_NODE
* the variable for the base type would be uninitialized
  if not a SYM_NODE.

So, remove the test and unconditionally set the base type.

Reported-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 evaluate.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/evaluate.c b/evaluate.c
index aa0f208006bb..461c2547285f 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -3304,9 +3304,7 @@ static struct symbol *evaluate_generic_selection(struct expression *expr)
 		if (!evaluate_symbol(stype))
 			continue;
 
-		if (stype->type == SYM_NODE)
-			base = stype->ctype.base_type;
-
+		base = stype->ctype.base_type;
 		if (base->type == SYM_ARRAY && base->array_size) {
 			get_expression_value_silent(base->array_size);
 			if (base->array_size->type == EXPR_VALUE)
-- 
2.27.0


             reply	other threads:[~2020-06-22 22:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-22 22:38 Luc Van Oostenryck [this message]
2020-06-22 22:38 ` [PATCH] gensel: remove unneeded test/uninitialized warning Luc Van Oostenryck

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=20200622223854.87802-1-luc.vanoostenryck@gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=ramsay@ramsayjones.plus.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).