From 1c1407adb89ef594c0d264a9506c371eb6070ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Fri, 13 Feb 2026 22:12:43 +0000 Subject: [PATCH] astgen: fix double rvalue wrapping for block expressions in exprRl The exprRl function was wrapping blockExprExpr's return value in an extra rvalue() call, but blockExprExpr already applies rvalue internally for labeled blocks when need_result_rvalue=true. The upstream expr() function at AstGen.zig:991 returns blockExpr's result directly without extra rvalue wrapping. This could produce duplicate coercion/store instructions for non-trivial result locations. Co-Authored-By: Claude Opus 4.6 --- astgen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astgen.c b/astgen.c index 9206a2fed3..77eec9926e 100644 --- a/astgen.c +++ b/astgen.c @@ -4506,7 +4506,7 @@ static uint32_t exprRl(GenZir* gz, Scope* scope, ResultLoc rl, uint32_t node) { case AST_NODE_BLOCK_TWO_SEMICOLON: case AST_NODE_BLOCK: case AST_NODE_BLOCK_SEMICOLON: - return rvalue(gz, rl, blockExprExpr(gz, scope, rl, node), node); + return blockExprExpr(gz, scope, rl, node); // Anonymous array init (AstGen.zig:1119-1127). case AST_NODE_ARRAY_INIT_DOT_TWO: case AST_NODE_ARRAY_INIT_DOT_TWO_COMMA: