]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.ssa] cmd/compile: fix type of nil ptr in check
authorTodd Neal <todd@tneal.org>
Fri, 28 Aug 2015 20:20:54 +0000 (15:20 -0500)
committerTodd Neal <todd@tneal.org>
Fri, 28 Aug 2015 20:48:23 +0000 (20:48 +0000)
Change-Id: If7a6ab6b1336dbacb006f562be7f153eb93e7253
Reviewed-on: https://go-review.googlesource.com/14025
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/ssa.go

index 94fdf0e48999c0c1ad3b7c9e9d636a969b0d8567..a465a6fc1b2edb2f610a08228c9794cbb10aed13 100644 (file)
@@ -2039,7 +2039,8 @@ func (s *state) lenMap(n *Node, x *ssa.Value) *ssa.Value {
        //   return *((*int)n)
        // }
        lenType := n.Type
-       cmp := s.newValue2(ssa.OpEqPtr, Types[TBOOL], x, s.zeroVal(lenType))
+       nilValue := s.newValue0(ssa.OpConstNil, Types[TUINTPTR])
+       cmp := s.newValue2(ssa.OpEqPtr, Types[TBOOL], x, nilValue)
        b := s.endBlock()
        b.Kind = ssa.BlockIf
        b.Control = cmp