From 73a84046844cc72a76e1593d419844f7ce36ffad Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 18 Nov 2024 11:51:10 +0900 Subject: [PATCH] [qfcc] Alias pointer etc to int for ! This fixes the calluse2 test. --- tools/qfcc/source/statements.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/qfcc/source/statements.c b/tools/qfcc/source/statements.c index c3323b241..9c5441f94 100644 --- a/tools/qfcc/source/statements.c +++ b/tools/qfcc/source/statements.c @@ -1866,13 +1866,18 @@ expr_not (sblock_t *sblock, const expr_t *e, operand_t **op) { if (options.code.progsversion == PROG_VERSION) { scoped_src_loc (e); + auto un = e->expr.e1; + auto type = get_type (un); + if (is_pointer (type) || is_func (type) + || is_entity (type) || is_field (type)) { + type = vector_type (&type_int, type_width (type)); + un = cast_expr (type, un); + } auto zero = new_nil_expr (); - zero->loc = e->loc; - zero = (expr_t *) convert_nil (zero, get_type (e->expr.e1)); + zero = (expr_t *) convert_nil (zero, type); - auto not = new_binary_expr (QC_EQ, e->expr.e1, zero); + auto not = new_binary_expr (QC_EQ, un, zero); not->expr.type = e->expr.type; - not->loc = e->loc; return statement_subexpr (sblock, not, op); } else {