From: Josh Bleecher Snyder Date: Fri, 28 Apr 2017 00:18:02 +0000 (-0700) Subject: cmd/compile: checkwidthj all expressions in walk X-Git-Tag: go1.9beta1~386 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=c4335f81a29dd6d43db7337707a27908c5059b0c;p=gostls13.git cmd/compile: checkwidthj all expressions in walk Instead of playing whack-a-mole finding all the non-dowidth'd expressions that can sneak out of the frontend and then deciding on just the right place to handle them, use a big hammer. Fixes #20152 Change-Id: Id452d9e8c4e9585216bd8bf0e0004c85aba4f9f7 Reviewed-on: https://go-review.googlesource.com/42021 Run-TryBot: Josh Bleecher Snyder Reviewed-by: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go index 9fd7e64c12..293e18eef0 100644 --- a/src/cmd/compile/internal/gc/walk.go +++ b/src/cmd/compile/internal/gc/walk.go @@ -461,6 +461,15 @@ func walkexpr(n *Node, init *Nodes) *Node { return n } + // Eagerly checkwidth all expressions for the back end. + if n.Type != nil && !n.Type.WidthCalculated() { + switch n.Type.Etype { + case TBLANK, TNIL, TIDEAL: + default: + checkwidth(n.Type) + } + } + if init == &n.Ninit { // not okay to use n->ninit when walking n, // because we might replace n with some other node