Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/link: panic during go test on tip #14783

Closed
peterbourgon opened this issue Mar 11, 2016 · 5 comments
Closed

cmd/link: panic during go test on tip #14783

peterbourgon opened this issue Mar 11, 2016 · 5 comments

Comments

@peterbourgon
Copy link

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?

go version devel +de4317c

  1. What operating system and processor architecture are you using (go env)?

linux/amd64

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
    A complete runnable program is good.
    A link on play.golang.org is best.

Travis CI ran the tests for my project, here is the job: https://travis-ci.org/go-kit/kit/jobs/115414128

  1. What did you expect to see?

Tests pass.

  1. What did you see instead?
# testmain
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0xf0 pc=0x4bd077]
goroutine 1 [running]:
panic(0x5a4c40, 0xc820018180)
    /home/travis/.gimme/versions/go/src/runtime/panic.go:500 +0x189
cmd/link/internal/ld.decodetype_funcincount(0x0, 0x28)
    /home/travis/.gimme/versions/go/src/cmd/link/internal/ld/decodesym.go:182 +0x27
cmd/link/internal/ld.decode_methodsig(0xc82119fad0, 0x40070, 0x30, 0x1, 0x1, 0x0, 0x4)
    /home/travis/.gimme/versions/go/src/cmd/link/internal/ld/decodesym.go:281 +0x121
cmd/link/internal/ld.decodetype_methods(0xc82119fad0, 0x0, 0x0, 0x0)
    /home/travis/.gimme/versions/go/src/cmd/link/internal/ld/decodesym.go:355 +0x169
cmd/link/internal/ld.(*deadcodepass).flood(0xc820041ce0)
    /home/travis/.gimme/versions/go/src/cmd/link/internal/ld/deadcode.go:296 +0xd50
cmd/link/internal/ld.deadcode(0xc82059e000)
    /home/travis/.gimme/versions/go/src/cmd/link/internal/ld/deadcode.go:56 +0xc5
cmd/link/internal/ld.Ldmain()
    /home/travis/.gimme/versions/go/src/cmd/link/internal/ld/pobj.go:190 +0x1349
cmd/link/internal/amd64.Main()
    /home/travis/.gimme/versions/go/src/cmd/link/internal/amd64/obj.go:44 +0x19
main.main()
    /home/travis/.gimme/versions/go/src/cmd/link/main.go:27 +0x27c

The build output is a little confusing, mea culpa. It looks like the test that triggers this panic is from package kit/log, you can find that by searching that page for "build failed".

@bradfitz bradfitz changed the title linker panic during go test on tip cmd/link: panic during go test on tip Mar 11, 2016
@bradfitz bradfitz added this to the Go1.7Early milestone Mar 11, 2016
@crawshaw
Copy link
Member

Is there something I can go get to reproduce this?

@dgryski
Copy link
Contributor

dgryski commented Mar 11, 2016

go get -v -u github.com/go-kit/kit/log

@davecheney
Copy link
Contributor

Thanks for the report. This looks like the *Lsym that decode_funcincount is trying to read into can be nil in some circumstances.

func decode_reloc_sym(s *LSym, off int32) *LSym {
    r := decode_reloc(s, off)
    if r == nil {
        return nil
    }
    return r.Sym
}

@crawshaw
Copy link
Member

Reproduction:

package main                                                                    

var three = 3                                                                   

type CustomT func(...interface{}) error                                         

func (f CustomT) M() {                                                          
        if 4 < three {                                                          
                f.M()                                                           
        }                                                                       
}                                                                               

func main() {                                                                   
        var v CustomT                                                           
        v.M()                                                                   
}

I believe I understand the cause and will get a CL out soon.

@gopherbot
Copy link

CL https://golang.org/cl/20566 mentions this issue.

@golang golang locked and limited conversation to collaborators Mar 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants