Commit c4335f81 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

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 <josharian@gmail.com>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent c1ac70ff
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment