]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.ssa] cmd/compile: make "*Value".String more robust
authorJosh Bleecher Snyder <josharian@gmail.com>
Sat, 22 Aug 2015 20:30:45 +0000 (13:30 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Mon, 24 Aug 2015 22:10:36 +0000 (22:10 +0000)
Change-Id: I4ae38440a33574421c9e3e350701e86e8a224b92
Reviewed-on: https://go-review.googlesource.com/13842
Reviewed-by: Todd Neal <todd@tneal.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/value.go

index 286edc0cdae4dc4580ed75da3fb519a3b1ab551d..04ea17cce914823a0c2ea7aa6591da58f69a1d87 100644 (file)
@@ -48,6 +48,9 @@ type Value struct {
 
 // short form print.  Just v#.
 func (v *Value) String() string {
+       if v == nil {
+               return "nil" // should never happen, but not panicking helps with debugging
+       }
        return fmt.Sprintf("v%d", v.ID)
 }