1
0
mirror of https://github.com/golang/go synced 2024-09-29 13:14:28 -06:00

cmd/compile: fix missing typecheck when rewriting abi.FuncPCABIxxx

Discover when running "go test -run=TestNewOSProc0 -gcflags=-d=checkptr"

Change-Id: I988da56fd3122a21673e86d7dd327ed05914ab72
Reviewed-on: https://go-review.googlesource.com/c/go/+/425040
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
Cuong Manh Le 2022-08-21 22:52:36 +07:00 committed by Gopher Robot
parent 8bf9e01473
commit ae303ff282

View File

@ -545,8 +545,7 @@ func walkCall(n *ir.CallExpr, init *ir.Nodes) ir.Node {
var e ir.Node = ir.NewLinksymExpr(n.Pos(), fn.Sym().LinksymABI(abi), types.Types[types.TUINTPTR])
e = ir.NewAddrExpr(n.Pos(), e)
e.SetType(types.Types[types.TUINTPTR].PtrTo())
e = ir.NewConvExpr(n.Pos(), ir.OCONVNOP, n.Type(), e)
return e
return typecheck.Expr(ir.NewConvExpr(n.Pos(), ir.OCONVNOP, n.Type(), e))
}
// fn is not a defined function. It must be ABIInternal.
// Read the address from func value, i.e. *(*uintptr)(idata(fn)).
@ -556,8 +555,10 @@ func walkCall(n *ir.CallExpr, init *ir.Nodes) ir.Node {
arg = walkExpr(arg, init)
var e ir.Node = ir.NewUnaryExpr(n.Pos(), ir.OIDATA, arg)
e.SetType(n.Type().PtrTo())
e.SetTypecheck(1)
e = ir.NewStarExpr(n.Pos(), e)
e.SetType(n.Type())
e.SetTypecheck(1)
return e
}