Commit 9c3f2685 authored by Martin Möhrmann's avatar Martin Möhrmann

cmd/compile: set hiter type for map iterator in order pass

Previously the type was first set to uint8 and then corrected
later in walkrange.

Change-Id: I9e4b597710e8a5fad39dde035df85676bc8d2874
Reviewed-on: https://go-review.googlesource.com/61032
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarKeith Randall <khr@golang.org>
parent bb312175
......@@ -762,8 +762,9 @@ func orderstmt(n *Node, order *Order) {
r := n.Right
n.Right = ordercopyexpr(r, r.Type, order, 0)
// n->alloc is the temp for the iterator.
prealloc[n] = ordertemp(types.Types[TUINT8], order, true)
// prealloc[n] is the temp for the iterator.
// hiter contains pointers and needs to be zeroed.
prealloc[n] = ordertemp(hiter(n.Type), order, true)
}
for i := range n.List.Slice() {
n.List.SetIndex(i, orderexprinplace(n.List.Index(i), order))
......
......@@ -249,9 +249,8 @@ func walkrange(n *Node) *Node {
// we only use a once, so no copy needed.
ha := a
th := hiter(t)
hit := prealloc[n]
hit.Type = th
th := hit.Type
n.Left = nil
keysym := th.Field(0).Sym // depends on layout of iterator struct. See reflect.go:hiter
valsym := th.Field(1).Sym // ditto
......
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