@@ -3579,6 +3579,22 @@ static void verify_input_constraint(struct asm_operand *op)
expression_error(expr, "input constraint with assignment (\"%s\")", constraint);
}
+static void evaluate_asm_memop(struct asm_operand *op)
+{
+ if (op->is_memory) {
+ struct expression *expr = op->expr;
+ struct expression *addr;
+
+ // implicit addressof
+ addr = alloc_expression(expr->pos, EXPR_PREOP);
+ addr->op = '&';
+ addr->unop = expr;
+
+ evaluate_addressof(addr);
+ op->expr = addr;
+ }
+}
+
static void evaluate_asm_statement(struct statement *stmt)
{
struct expression *expr;
@@ -3604,6 +3620,7 @@ static void evaluate_asm_statement(struct statement *stmt)
if (!lvalue_expression(expr))
warning(expr->pos, "asm output is not an lvalue");
evaluate_assign_to(expr, expr->ctype);
+ evaluate_asm_memop(op);
} END_FOR_EACH_PTR(op);
FOR_EACH_PTR(stmt->asm_inputs, op) {
@@ -3618,6 +3635,7 @@ static void evaluate_asm_statement(struct statement *stmt)
/* Expression */
if (!evaluate_expression(op->expr))
return;
+ evaluate_asm_memop(op);
} END_FOR_EACH_PTR(op);
FOR_EACH_PTR(stmt->asm_clobbers, expr) {
@@ -9,7 +9,6 @@ void fo3(int *p) { asm volatile ("op %0" :: "m" (*p)); }
/*
* check-name: eval-asm-memop
* check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
*
* check-output-start
fo0:
The operands of extended ASM need to have their type evaluated, exactly like any other expression. So, add the missing evaluation of ASM operands. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- evaluate.c | 18 ++++++++++++++++++ validation/eval/asm-memop.c | 1 - 2 files changed, 18 insertions(+), 1 deletion(-)