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 build with buildmode=plugin #17443

Closed
mateuszdyminski opened this issue Oct 14, 2016 · 1 comment

Comments

Projects
None yet
4 participants
@mateuszdyminski
Copy link

commented Oct 14, 2016

go version

go version devel +d13fa4d Fri Oct 14 03:58:15 2016 +0000 linux/amd64

go env

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/md/.gvm/pkgsets/master/global"
GORACE=""
GOROOT="/home/md/.gvm/gos/master"
GOTOOLDIR="/home/md/.gvm/gos/master/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build545183226=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

What did you do?

I tried to build following code:

package main

func Test(value string) string {
return "test" + value
}

by calling go build -buildmode=plugin

What did you expect to see?

go build -buildmode=plugin should not return any error

When func Test(value string) string has no string argument:

package main

func Test() string {
return "test"
}

code compiles without any error.

What did you see instead?

panic: runtime error: index out of range

goroutine 1 [running]:
panic(0x5aa860, 0x69d560)
/home/md/.gvm/gos/master/src/runtime/panic.go:527 +0x1a0
cmd/link/internal/ld.(*deadcodepass).flood(0xc42006fce0)
/home/md/.gvm/gos/master/src/cmd/link/internal/ld/deadcode.go:292 +0xdd2
cmd/link/internal/ld.deadcode(0xc4200768f0)
/home/md/.gvm/gos/master/src/cmd/link/internal/ld/deadcode.go:62 +0xdb
cmd/link/internal/ld.Main()
/home/md/.gvm/gos/master/src/cmd/link/internal/ld/main.go:186 +0x81b
main.main()
/home/md/.gvm/gos/master/src/cmd/link/main.go:55 +0x139

@quentinmit quentinmit added this to the Go1.8 milestone Oct 17, 2016

@quentinmit quentinmit changed the title plugin: 'index out of range' when build with buildmode=plugin cmd/link: 'index out of range' when build with buildmode=plugin Oct 17, 2016

@crawshaw

This comment has been minimized.

Copy link
Contributor

commented Oct 26, 2016

I believe this is #17140, which I believe is fixed by https://golang.org/cl/29692, which is waiting for review.

@crawshaw crawshaw closed this Oct 26, 2016

@golang golang locked and limited conversation to collaborators Oct 26, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.