Skip to contentSkip to conversation

fix floating point ! type

PATCH In review Xi Wang 1 participant 2 messages May 16, 2013 – May 17, 2013 Sparse checker

lore
Share & tools
lore

Xi Wang

author
#0 lore raw

PATCH 1/1 fix floating point ! type

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

---
 evaluate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
evaluate.c +1 -1
index a090028..c345a50 100644
@@ -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);
Signature · 1 line
1.8.1.2
author
#1 lore raw
Quoted 2 lines · Xi Wang

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.