From ae303ff282feed715de0374890737ccdaee1e053 Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Sun, 21 Aug 2022 22:52:36 +0700 Subject: [PATCH] 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 --- src/cmd/compile/internal/walk/expr.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cmd/compile/internal/walk/expr.go b/src/cmd/compile/internal/walk/expr.go index dfa82e7ec03..c80bc3d80bf 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 }