From 116a53553bfc3f5c55fb532550b97be8fab4c200 Mon Sep 17 00:00:00 2001 From: lemon Date: Sat, 11 Apr 2026 12:13:08 +0200 Subject: x86-64/emit: fix stack arg offset for edgecases It was wrong for functions that didn't use the frame pointer but took arguments in the stack --- src/t_x86-64_emit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/t_x86-64_emit.c b/src/t_x86-64_emit.c index 616ccf4..6079f3c 100644 --- a/src/t_x86-64_emit.c +++ b/src/t_x86-64_emit.c @@ -1360,7 +1360,6 @@ emitbin(Function *fn) DS("\x55\x48\x89\xE5"); } saverestore = npush = calleesave(pcode, fn); - npush += !frame.usebp; /* ensure stack is 16-byte aligned */ if (frame.usebp) { @@ -1370,6 +1369,8 @@ emitbin(Function *fn) fn->stksiz += 8; frame.size += 8; } + } else { + frame.size = npush*8; } frame.stksiz = fn->stksiz; -- cgit v1.2.3