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: Christopher Li <sparse@chrisli.org>,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 1/5] do not linearize expressions without a type
Date: Tue, 19 Sep 2017 04:13:31 +0200	[thread overview]
Message-ID: <20170919021335.5881-2-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20170919021335.5881-1-luc.vanoostenryck@gmail.com>

Expressions without a type are the result of previous
errors which left them unevaluated or only partially
evaluated.

Further processing, like here linearization, then
produce nonsensical or erroneous results, with error
messages unrelated to the cause of the error, like:
"unknown expression (...)" or "call with no type!".

Fix this by refusing to linearize an expressions without
a type.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 linearize.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linearize.c b/linearize.c
index ba76397ea..c36735cdd 100644
--- a/linearize.c
+++ b/linearize.c
@@ -1581,7 +1581,7 @@ static void linearize_argument(struct entrypoint *ep, struct symbol *arg, int nr
 
 pseudo_t linearize_expression(struct entrypoint *ep, struct expression *expr)
 {
-	if (!expr)
+	if (!expr || !expr->ctype)
 		return VOID;
 
 	current_pos = expr->pos;
-- 
2.14.0


  reply	other threads:[~2017-09-19  2:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19  2:13 [PATCH 0/5] expressions without a type Luc Van Oostenryck
2017-09-19  2:13 ` Luc Van Oostenryck [this message]
2017-09-19  2:13 ` [PATCH 2/5] add helper: valid_type() Luc Van Oostenryck
2017-09-19  2:13 ` [PATCH 3/5] add helper: valid_expr_subtype() Luc Van Oostenryck
2017-09-19  2:13 ` [PATCH 4/5] do not report bad types twice or more Luc Van Oostenryck
2017-09-19  2:13 ` [PATCH 5/5] always evaluate both operands 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=20170919021335.5881-2-luc.vanoostenryck@gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sparse@chrisli.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).