From: Cuong Manh Le Date: Sun, 21 Aug 2022 15:52:36 +0000 (+0700) Subject: cmd/compile: fix missing typecheck when rewriting abi.FuncPCABIxxx X-Git-Tag: go1.20rc1~1475 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ae303ff282feed715de0374890737ccdaee1e053;p=gostls13.git 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 Auto-Submit: Cuong Manh Le Run-TryBot: Cuong Manh Le Reviewed-by: Matthew Dempsky Reviewed-by: Cherry Mui --- diff --git a/src/cmd/compile/internal/walk/expr.go b/src/cmd/compile/internal/walk/expr.go index dfa82e7ec0..c80bc3d80b 100644 --- a/src/cmd/compile/internal/walk/expr.go +++ b/src/cmd/compile/internal/walk/expr.go @@ -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 }