[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-sparse
Subject:    Re: bad_expr_type
From:       terra () gnome ! org (Morten Welinder)
Date:       2004-07-26 19:57:32
Message-ID: 20040726195732.0D04A1422D58 () darter ! rentec ! com
[Download RAW message or body]




/home/welinder/foo.c:6:12: warning: incompatible types for operation ==:
/home/welinder/foo.c:6:12:   left side has type double x
/home/welinder/foo.c:6:12:   right side has type double [usertype] y

Fixed by this patch.  Looks like simple oversight.

Morten




===== evaluate.c 1.216 vs edited =====
--- 1.216/evaluate.c	2004-07-24 21:45:40 -04:00
+++ edited/evaluate.c	2004-07-26 15:51:59 -04:00
@@ -212,7 +212,22 @@
 
 static struct symbol *bad_expr_type(struct expression *expr)
 {
-	warn(expr->pos, "incompatible types for operation");
+	warn(expr->pos, "incompatible types for operation %s:", show_special (expr->op));
+	switch (expr->type) {
+	case EXPR_BINOP:
+	case EXPR_COMPARE:
+		info(expr->pos, "  left side has type %s", show_typename (expr->left->ctype));
+		info(expr->pos, "  right side has type %s", show_typename (expr->right->ctype));
+		break;
+	case EXPR_PREOP:
+	case EXPR_POSTOP:
+		info(expr->pos, "  argument has type %s", show_typename (expr->unop->ctype));
+		break;
+	default:
+		info(expr->pos, "  better add some stuff here.");
+		break;
+	}
+
 	return NULL;
 }
 
@@ -741,6 +756,10 @@
 		return &bool_ctype;
 	}
 	ctype = compatible_float_binop(&expr->left, &expr->right);
+	if (ctype) {
+		expr->ctype = &bool_ctype;
+		return &bool_ctype;
+	}
 
 	return bad_expr_type(expr);
 }
-
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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic