]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj: fix nil pointer dereference in Dconv
authorMichael Munday <munday@ca.ibm.com>
Fri, 11 Mar 2016 15:21:51 +0000 (10:21 -0500)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 11 Mar 2016 16:58:41 +0000 (16:58 +0000)
p can be nil in Dconv so we need to do a check before dereferencing
it. Fixes a problem I was having running toolstash.

Change-Id: I34d6d278b319583d8454c2342ac88e054fc4b641
Reviewed-on: https://go-review.googlesource.com/20595
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/internal/obj/util.go

index 7b70d3c58457456259aa9c28be992267ff1ce279..4c37f76ca9cf63e8878503b9584bc9ac8e433834 100644 (file)
@@ -406,7 +406,7 @@ func Dconv(p *Prog, a *Addr) string {
                if a.Index != REG_NONE {
                        str += fmt.Sprintf("(%v*%d)", Rconv(int(a.Index)), int(a.Scale))
                }
-               if p.As == ATYPE && a.Gotype != nil {
+               if p != nil && p.As == ATYPE && a.Gotype != nil {
                        str += fmt.Sprintf("%s", a.Gotype.Name)
                }