mirror of https://github.com/golang/go.git
cmd/compile: fix crash in importer when running in debug mode
Verified by manually enabling debug mode and running make.bash. Fixes #20684. Change-Id: I041f2ca6ef1d4198815724d98f61511072d63581 Reviewed-on: https://go-review.googlesource.com/45971 Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
6e549d2dfd
commit
ebcdda4732
|
|
@ -564,7 +564,12 @@ func (p *exporter) pos(n *Node) {
|
|||
|
||||
func (p *exporter) path(s string) {
|
||||
if i, ok := p.pathIndex[s]; ok {
|
||||
p.index('p', i) // i >= 0
|
||||
// Note: Using p.index(i) here requires the use of p.tag(-len(c)) below
|
||||
// to get matching debug markers ('t'). But in trace mode p.tag
|
||||
// assumes that the tag argument is a valid tag that can be looked
|
||||
// up in the tagString list, rather then some arbitrary slice length.
|
||||
// Use p.int instead.
|
||||
p.int(i) // i >= 0
|
||||
return
|
||||
}
|
||||
p.pathIndex[s] = len(p.pathIndex)
|
||||
|
|
|
|||
|
|
@ -420,12 +420,9 @@ func (p *importer) pos() src.XPos {
|
|||
}
|
||||
|
||||
func (p *importer) path() string {
|
||||
if p.debugFormat {
|
||||
p.marker('p')
|
||||
}
|
||||
// if the path was seen before, i is its index (>= 0)
|
||||
// (the empty string is at index 0)
|
||||
i := p.rawInt64()
|
||||
i := p.int()
|
||||
if i >= 0 {
|
||||
return p.pathList[i]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue