From 18c0ea365710dbaafab50dd45d7380d2ab8c6397 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 20 Dec 2023 22:51:58 +0900 Subject: [PATCH] [qfcc] Ensure one is the correct type for incop expressions This makes for nicer generated code when the incop (especially post) is used in a condition. --- tools/qfcc/source/expr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index d58a681fc..97efebbae 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -2524,6 +2524,9 @@ incop_expr (int op, const expr_t *e, int postop) return e; auto one = new_int_expr (1); // int constants get auto-cast to float + if (is_scalar (get_type (e))) { + one = cast_expr (get_type (e), one); + } if (postop) { expr_t *t1, *t2; type_t *type = get_type (e);