From 35de42aeac9ce15f2f5e5374e17c1c35130ceba9 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 24 Jun 2013 11:34:38 +0900 Subject: [PATCH] Catch bogus comparison types. This fixes an ICE when trying to compare a function with a float. --- tools/qfcc/source/expr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index 67307b0e2..f734710b2 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -1539,6 +1539,10 @@ binary_expr (int op, expr_t *e1, expr_t *e2) type = t1; + if (is_compare (op)) { + if (!type_assignable (t1, t2)) + return error (e1, "type mismatch for %s", get_op_string (op)); + } if (is_compare (op) || is_logic (op)) { if (options.code.progsversion > PROG_ID_VERSION) type = &type_integer;