diff mbox

fix floating point ! type

Message ID 1368737773-6559-1-git-send-email-xi.wang@gmail.com (mailing list archive)
State Rejected, archived
Headers show

Commit Message

Xi Wang May 16, 2013, 8:56 p.m. UTC
The expression type of zero testing should be EXPR_COMPARE, rather
than EXPR_BINOP.

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

Comments

Xi Wang May 17, 2013, 9:52 p.m. UTC | #1
On Thu, May 16, 2013 at 4:56 PM, Xi Wang <xi.wang@gmail.com> wrote:
> The expression type of zero testing should be EXPR_COMPARE, rather
> than EXPR_BINOP.

There might be a bigger problem.  The C standard says the result type
of comparisons, !, &&, || should be int, rather than bool.
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/evaluate.c b/evaluate.c
index a090028..c345a50 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -1807,7 +1807,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);