diff options
| -rw-r--r-- | evaluate.c | 18 | ||||
| -rw-r--r-- | validation/eval/asm-memop.c | 1 |
2 files changed, 18 insertions, 1 deletions
@@ -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) { diff --git a/validation/eval/asm-memop.c b/validation/eval/asm-memop.c index 9bbb3a30..33ba0e5a 100644 --- a/validation/eval/asm-memop.c +++ b/validation/eval/asm-memop.c @@ -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: |
