From 4ec3486a4b8ee049ae1a756da2ad7463bf271056 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 1 Feb 2022 20:01:13 +0900 Subject: [PATCH] [qfcc] Make lea generate a pointer operand I really need to come up with a better way to get the result type into the flow analyser. However, this fixes the aliasing ICE when optimizing Ruamoko code that uses struct assignment. --- tools/qfcc/source/statements.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/qfcc/source/statements.c b/tools/qfcc/source/statements.c index 3f60f15fa..bfa782205 100644 --- a/tools/qfcc/source/statements.c +++ b/tools/qfcc/source/statements.c @@ -873,6 +873,13 @@ expr_assign_copy (sblock_t *sblock, expr_t *e, operand_t **op, operand_t *src) sblock = statement_subexpr (sblock, src_expr, &use); } if (options.code.progsversion == PROG_VERSION) { + // FIXME it was probably a mistake extracting the operand + // type from the statement expression in dags. Also, can't + // use address_expr() because src_expr may be a function call + // and unary_expr doesn't like that + src_expr = expr_file_line ( + new_address_expr (get_type (src_expr), src_expr, 0), + src_expr); s = lea_statement (src, 0, src_expr); sblock_add_statement (sblock, s); src = s->opc;