From b66cbeeb57730f9f6be37814e7cbcde4e3751241 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 27 Jun 2013 09:24:56 +0900 Subject: [PATCH] Run fold_constants on comparison operands. This is a bit of a workaround to ensure the operands have their types setup correctly. Really, binary_expr needs to handle expression types properly. This fixes the bogus error for comparing the result of pointer subtraction with an integer. --- 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 4d4f37e31..f44344084 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -1626,6 +1626,10 @@ binary_expr (int op, expr_t *e1, expr_t *e2) e1 = test_expr (e1); e2 = test_expr (e2); } + if (is_compare (op)) { + e1 = fold_constants (e1); + e2 = fold_constants (e2); + } if (e1->type == ex_error) return e1;