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: index out of range when compiling plugin #17140

Closed
nussjustin opened this issue Sep 17, 2016 · 2 comments
Closed

cmd/link: index out of range when compiling plugin #17140

nussjustin opened this issue Sep 17, 2016 · 2 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@nussjustin
Copy link
Contributor

Please answer these questions before submitting your issue. Thanks!

What did you do?

Tried to compile the following:

package main

// // Nothing to do
import "C"

var Init = func() {
}

func main() {

}

Command: go build -buildmode=plugin plugin.go

What did you expect to see?

No errors.

What did you see instead?

# command-line-arguments
panic: runtime error: index out of range

goroutine 1 [running]:
panic(0x5a2480, 0x68f500)
    /opt/go/src/runtime/panic.go:496 +0x1a0
cmd/link/internal/ld.(*deadcodepass).flood(0xc42006fce8)
    /opt/go/src/cmd/link/internal/ld/deadcode.go:289 +0xe39
cmd/link/internal/ld.deadcode(0xc4204c0000)
    /opt/go/src/cmd/link/internal/ld/deadcode.go:60 +0xdb
cmd/link/internal/ld.Main()
    /opt/go/src/cmd/link/internal/ld/main.go:185 +0x802
main.main()
    /opt/go/src/cmd/link/main.go:55 +0x142

System details

go version devel +2e2db7a Sat Sep 17 02:54:11 2016 +0000 linux/amd64
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/justinn/Workspace/go"
GORACE=""
GOROOT="/opt/go"
GOTOOLDIR="/opt/go/pkg/tool/linux_amd64"
TERM="dumb"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build787786251=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
uname -sr: Linux 4.7.2-1-ARCH
/usr/lib/libc.so.6: GNU C Library (GNU libc) stable release version 2.24, by Roland McGrath et al.
gdb --version: GNU gdb (GDB) 7.11.1
@crawshaw crawshaw self-assigned this Sep 17, 2016
@crawshaw crawshaw mentioned this issue Sep 22, 2016
@gopherbot
Copy link

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

@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 3, 2016
@quentinmit quentinmit added this to the Go1.8 milestone Oct 3, 2016
@rogpeppe
Copy link
Contributor

I see a similar error when trying to compile this plugin code.

package main

func Bar() interface{} {
    return nil
}

Maybe a different bug as it panics on a different line.
len(s.P) is zero.

panic: runtime error: index out of range

goroutine 1 [running]:
panic(0x5a5f20, 0x6944e0)
    /home/rog/go/src/runtime/panic.go:527 +0x1a0
cmd/link/internal/ld.(*deadcodepass).flood(0xc420071ce0)
    /home/rog/go/src/cmd/link/internal/ld/deadcode.go:292 +0xe14
cmd/link/internal/ld.deadcode(0xc420016a90)
    /home/rog/go/src/cmd/link/internal/ld/deadcode.go:62 +0xdb
cmd/link/internal/ld.Main()
    /home/rog/go/src/cmd/link/internal/ld/main.go:186 +0x81b
main.main()
    /home/rog/go/src/cmd/link/main.go:55 +0x139

go version devel +1af769d Thu Oct 13 06:16:53 2016 +0000 linux/amd64

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants