From: Keith Randall Date: Fri, 1 Aug 2025 14:38:55 +0000 (-0700) Subject: cmd/compile: enforce that locals are always accessed with SP base register X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=eef5f8d93016147718afba8a05282d2ba7332c51;p=gostls13.git cmd/compile: enforce that locals are always accessed with SP base register After CL 678937, we could have a situation where the value of the stack pointer is in both SP and another register. We need to make sure that regalloc picks SP when issuing a reference to local variables; the assembler expects that. Fixes #74836 Change-Id: I2ac73ece6eb44b4a78c1369f8a69e51ab9748754 Reviewed-on: https://go-review.googlesource.com/c/go/+/692395 Reviewed-by: Cuong Manh Le Reviewed-by: Keith Randall Reviewed-by: Mark Freeman LUCI-TryBot-Result: Go LUCI --- diff --git a/src/cmd/compile/internal/ssa/regalloc.go b/src/cmd/compile/internal/ssa/regalloc.go index de49bb40c5..fb9642cfed 100644 --- a/src/cmd/compile/internal/ssa/regalloc.go +++ b/src/cmd/compile/internal/ssa/regalloc.go @@ -1583,6 +1583,12 @@ func (s *regAllocState) regalloc(f *Func) { mask &^= desired.avoid } } + if mask&s.values[v.Args[i.idx].ID].regs&(1<