diff --git a/tools/qfcc/source/expr_binary.c b/tools/qfcc/source/expr_binary.c index 8396d4149..c55182667 100644 --- a/tools/qfcc/source/expr_binary.c +++ b/tools/qfcc/source/expr_binary.c @@ -1119,6 +1119,14 @@ binary_expr (int op, expr_t *e1, expr_t *e2) t2 = &type_float; e2 = cast_expr (t2, e2); } + if (is_array (t1) && (is_ptr (t2) || is_integral (t2))) { + t1 = pointer_type (t1->t.array.type); + e1 = cast_expr (t1, e1); + } + if (is_array (t2) && (is_ptr (t1) || is_integral (t1))) { + t2 = pointer_type (t2->t.array.type); + e2 = cast_expr (t2, e2); + } et1 = low_level_type (t1); et2 = low_level_type (t2); diff --git a/tools/qfcc/source/statements.c b/tools/qfcc/source/statements.c index 833545c57..018803d94 100644 --- a/tools/qfcc/source/statements.c +++ b/tools/qfcc/source/statements.c @@ -677,6 +677,11 @@ expr_address (sblock_t *sblock, expr_t *e, operand_t **op) lvalue->e.alias.expr, expr_int (offset)); offset = 0; + } else if (offset && is_constant (offset)) { + int o = expr_int (offset); + if (o < 32768 && o >= -32768) { + offset = expr_file_line (new_short_expr (o), offset); + } } s = new_statement (st_address, "lea", e);