All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xi Wang <xi.wang@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Christopher Li <sparse@chrisli.org>, Xi Wang <xi.wang@gmail.com>
Subject: [PATCH 2/2] fix expression type for floating point !
Date: Fri, 24 May 2013 09:30:36 -0400	[thread overview]
Message-ID: <1369402236-16871-2-git-send-email-xi.wang@gmail.com> (raw)
In-Reply-To: <1369402236-16871-1-git-send-email-xi.wang@gmail.com>

Run test-linearize against this program.

	static int foo(float x) { return !x; }

The output is:

	set.32      %r2 <- 0.000000
	bad_op.32
	ret.32      %r3

The expression type of zero testing should be EXPR_COMPARE, rather than
EXPR_BINOP, which causes bad_op.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
---
 evaluate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/evaluate.c b/evaluate.c
index 5d87444..19be637 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -1797,7 +1797,7 @@ static struct symbol *evaluate_preop(struct expression *expr)
 			warning(expr->pos, "testing a 'safe expression'");
 		if (is_float_type(ctype)) {
 			struct expression *arg = expr->unop;
-			expr->type = EXPR_BINOP;
+			expr->type = EXPR_COMPARE;
 			expr->op = SPECIAL_EQUAL;
 			expr->left = arg;
 			expr->right = alloc_expression(expr->pos, EXPR_FVALUE);
-- 
1.8.1.2


  reply	other threads:[~2013-05-24 13:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-24 13:30 [PATCH 1/2] fix result type of relational and logical operators Xi Wang
2013-05-24 13:30 ` Xi Wang [this message]
2013-05-27  8:09   ` [PATCH 2/2] fix expression type for floating point ! Christopher Li
2013-05-27 11:13     ` Pekka Enberg
2013-05-27  6:33 ` [PATCH 1/2] fix result type of relational and logical operators Pekka Enberg
2013-05-27  8:07   ` Christopher Li

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=1369402236-16871-2-git-send-email-xi.wang@gmail.com \
    --to=xi.wang@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.