From 811b13a9d3c4d1e5e769a6c83e2766b0c8f85ee2 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Tue, 18 Feb 2025 13:59:28 +0100 Subject: [PATCH] interp: correctly mark functions as modifying memory Previously, if a function couldn't be interpreted in the interp pass, it would just be run at runtime and the parameters would be marked as potentially being modified. However, this is incorrect: the function itself can also modify memory. So the function itself also needs to be marked (recursively). This fixes a number of regressions while upgrading to Go 1.24. This results in a significant size regression that is mostly worked around in the next commit. --- interp/interpreter.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interp/interpreter.go b/interp/interpreter.go index 20d56c69e..3813035e1 100644 --- a/interp/interpreter.go +++ b/interp/interpreter.go @@ -970,9 +970,9 @@ func (r *runner) runAtRuntime(fn *function, inst instruction, locals []value, me case llvm.Call: llvmFn := operands[len(operands)-1] args := operands[:len(operands)-1] - for _, arg := range args { - if arg.Type().TypeKind() == llvm.PointerTypeKind { - err := mem.markExternalStore(arg) + for _, op := range operands { + if op.Type().TypeKind() == llvm.PointerTypeKind { + err := mem.markExternalStore(op) if err != nil { return r.errorAt(inst, err) }