llgo/ssa: MapUpdate fix

This commit is contained in:
xushiwei
2024-06-14 22:33:40 +08:00
parent 8d42acec16
commit e107567997
3 changed files with 17 additions and 13 deletions

View File

@@ -366,7 +366,8 @@ func (b Builder) MapUpdate(m, k, v Expr) {
}
tabi := b.abiType(t.raw.Type)
prog := b.Prog
ptrimpl := b.InlineCall(b.Pkg.rtFunc("MapAssign"), tabi, m, k).impl
mptr := b.dupAlloca(m)
ptrimpl := b.InlineCall(b.Pkg.rtFunc("MapAssign"), tabi, mptr, k).impl
ptr := Expr{ptrimpl, prog.Pointer(v.Type)}
b.Store(ptr, v) // TODO(xsw): indirect store
}