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/compile/internal/noder: index out of range #49611

Closed
johejo opened this issue Nov 16, 2021 · 2 comments
Closed

cmd/compile/internal/noder: index out of range #49611

johejo opened this issue Nov 16, 2021 · 2 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@johejo
Copy link

johejo commented Nov 16, 2021

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

$ go version
go version devel go1.18-6e481c0b36 Tue Nov 16 08:58:05 2021 +0000 linux/amd64

Does this issue reproduce with the latest release?

No, tip only.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/johejo/.cache/go-build"
GOENV="/home/johejo/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/johejo/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/johejo/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/johejo/ghq/github.com/golang/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/johejo/ghq/github.com/golang/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="devel go1.18-6e481c0b36 Tue Nov 16 08:58:05 2021 +0000"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/johejo/ghq/github.com/cilium/cilium/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build326379352=/tmp/go-build -gno-record-gcc-switches"

What did you do?

git clone https://github.com/clium/cilium.git
cd cilium/
go build ./...

What did you expect to see?

build succeeds

What did you see instead?

paniced

# github.com/cilium/cilium/api/v1/client/daemon
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
cmd/compile/internal/noder.(*irgen).stmt(0xc000314480, {0xe88930?, 0xc0003e5ce0?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/stmt.go:49 +0x1075
cmd/compile/internal/noder.(*irgen).stmts(0xc000be4c40?, {0xc0003e8b60?, 0x2, 0xc0008ed648?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/stmt.go:19 +0xaf
cmd/compile/internal/noder.(*irgen).funcBody(0xc000314480, 0xc000bea000, 0xc0004397a0?, 0xc0003ea240, 0xc0003ea2c0)
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/func.go:45 +0x25f
cmd/compile/internal/noder.(*irgen).funcDecl.func1()
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/decl.go:143 +0xf5
cmd/compile/internal/noder.(*irgen).generate(0xc000314480, {0xc0000ea500, 0xf, 0x203000?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/irgen.go:280 +0x227
cmd/compile/internal/noder.check2({0xc0000ea500, 0xf, 0xf})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/irgen.go:92 +0x16d
cmd/compile/internal/noder.LoadPackage({0xc0000bc100, 0xf, 0x0?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/noder.go:90 +0x335
cmd/compile/internal/gc.Main(0xd46330)
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/gc/main.go:191 +0xb13
main.main()
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/main.go:55 +0xdd
# github.com/cilium/cilium/api/v1/client/endpoint
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
cmd/compile/internal/noder.(*irgen).stmt(0xc00039e0c0, {0xe88930?, 0xc000095aa0?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/stmt.go:49 +0x1075
cmd/compile/internal/noder.(*irgen).stmts(0xc000d3d810?, {0xc00050a560?, 0x2, 0x203000?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/stmt.go:19 +0xaf
cmd/compile/internal/noder.(*irgen).funcBody(0xc00039e0c0, 0xc000d1c420, 0xc000a72f50?, 0xc0000b9d80, 0xc0000b9e00)
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/func.go:45 +0x25f
cmd/compile/internal/noder.(*irgen).funcDecl.func1()
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/decl.go:143 +0xf5
cmd/compile/internal/noder.(*irgen).generate(0xc00039e0c0, {0xc00039e300, 0x17, 0x203000?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/irgen.go:280 +0x227
cmd/compile/internal/noder.check2({0xc00039e300, 0x17, 0x17})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/irgen.go:92 +0x16d
cmd/compile/internal/noder.LoadPackage({0xc0000ba100, 0x17, 0x0?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/noder.go:90 +0x335
cmd/compile/internal/gc.Main(0xd46330)
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/gc/main.go:191 +0xb13
main.main()
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/main.go:55 +0xdd
# github.com/cilium/cilium/api/v1/client/ipam
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
cmd/compile/internal/noder.(*irgen).stmt(0xc00015c540, {0xe88930?, 0xc0000941e0?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/stmt.go:49 +0x1075
cmd/compile/internal/noder.(*irgen).stmts(0xc00099f340?, {0xc0003e9de0?, 0x2, 0x203000?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/stmt.go:19 +0xaf
cmd/compile/internal/noder.(*irgen).funcBody(0xc00015c540, 0xc00097f600, 0xc00084cd20?, 0xc000113900, 0xc000113980)
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/func.go:45 +0x25f
cmd/compile/internal/noder.(*irgen).funcDecl.func1()
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/decl.go:143 +0xf5
cmd/compile/internal/noder.(*irgen).generate(0xc00015c540, {0xc000113780, 0x7, 0x203000?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/irgen.go:280 +0x227
cmd/compile/internal/noder.check2({0xc000113780, 0x7, 0x7})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/irgen.go:92 +0x16d
cmd/compile/internal/noder.LoadPackage({0xc00001e280, 0x7, 0x0?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/noder.go:90 +0x335
cmd/compile/internal/gc.Main(0xd46330)
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/gc/main.go:191 +0xb13
main.main()
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/main.go:55 +0xdd
# github.com/cilium/cilium/api/v1/client/policy
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
cmd/compile/internal/noder.(*irgen).stmt(0xc0006f80c0, {0xe88930?, 0xc00007c540?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/stmt.go:49 +0x1075
cmd/compile/internal/noder.(*irgen).stmts(0xc0009c9260?, {0xc00003b6c0?, 0x2, 0xcddbe0?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/stmt.go:19 +0xaf
cmd/compile/internal/noder.(*irgen).funcBody(0xc0006f80c0, 0xc00074d080, 0xc000af5ce0?, 0xc00014ac80, 0xc00014ad00)
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/func.go:45 +0x25f
cmd/compile/internal/noder.(*irgen).funcDecl.func1()
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/decl.go:143 +0xf5
cmd/compile/internal/noder.(*irgen).generate(0xc0006f80c0, {0xc000432000, 0x1b, 0x203000?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/irgen.go:280 +0x227
cmd/compile/internal/noder.check2({0xc000432000, 0x1b, 0x1b})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/irgen.go:92 +0x16d
cmd/compile/internal/noder.LoadPackage({0xc00001e3c0, 0x1b, 0x0?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/noder.go:90 +0x335
cmd/compile/internal/gc.Main(0xd46330)
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/gc/main.go:191 +0xb13
main.main()
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/main.go:55 +0xdd
# github.com/cilium/cilium/api/v1/client/prefilter
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
cmd/compile/internal/noder.(*irgen).stmt(0xc000334480, {0xe88930?, 0xc00007ce70?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/stmt.go:49 +0x1075
cmd/compile/internal/noder.(*irgen).stmts(0xc00039a0e0?, {0xc00003b5e0?, 0x2, 0xcddbe0?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/stmt.go:19 +0xaf
cmd/compile/internal/noder.(*irgen).funcBody(0xc000334480, 0xc0008fd340, 0xc000847340?, 0xc000483340, 0xc0004833c0)
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/func.go:45 +0x25f
cmd/compile/internal/noder.(*irgen).funcDecl.func1()
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/decl.go:143 +0xf5
cmd/compile/internal/noder.(*irgen).generate(0xc000334480, {0xc000327680, 0x7, 0x203000?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/irgen.go:280 +0x227
cmd/compile/internal/noder.check2({0xc000327680, 0x7, 0x7})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/irgen.go:92 +0x16d
cmd/compile/internal/noder.LoadPackage({0xc0000ba100, 0x7, 0x0?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/noder.go:90 +0x335
cmd/compile/internal/gc.Main(0xd46330)
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/gc/main.go:191 +0xb13
main.main()
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/main.go:55 +0xdd
# github.com/cilium/cilium/api/v1/client/recorder
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
cmd/compile/internal/noder.(*irgen).stmt(0xc00033c3c0, {0xe88930?, 0xc0004db410?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/stmt.go:49 +0x1075
cmd/compile/internal/noder.(*irgen).stmts(0xc000ab56c0?, {0xc0004dd5c0?, 0x2, 0xcddbe0?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/stmt.go:19 +0xaf
cmd/compile/internal/noder.(*irgen).funcBody(0xc00033c3c0, 0xc000a86dc0, 0xc00038b500?, 0xc0004d7dc0, 0xc0004d7e40)
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/func.go:45 +0x25f
cmd/compile/internal/noder.(*irgen).funcDecl.func1()
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/decl.go:143 +0xf5
cmd/compile/internal/noder.(*irgen).generate(0xc00033c3c0, {0xc0000b7920, 0xb, 0x203000?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/irgen.go:280 +0x227
cmd/compile/internal/noder.check2({0xc0000b7920, 0xb, 0xb})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/irgen.go:92 +0x16d
cmd/compile/internal/noder.LoadPackage({0xc0000ba100, 0xb, 0x0?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/noder.go:90 +0x335
cmd/compile/internal/gc.Main(0xd46330)
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/gc/main.go:191 +0xb13
main.main()
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/main.go:55 +0xdd
# github.com/cilium/cilium/api/v1/client/service
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
cmd/compile/internal/noder.(*irgen).stmt(0xc000396540, {0xe88930?, 0xc00045cea0?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/stmt.go:49 +0x1075
cmd/compile/internal/noder.(*irgen).stmts(0xc000a69180?, {0xc0000fa140?, 0x2, 0xcddbe0?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/stmt.go:19 +0xaf
cmd/compile/internal/noder.(*irgen).funcBody(0xc000396540, 0xc000a542c0, 0xc00087a3f0?, 0xc0000fc240, 0xc0000fc2c0)
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/func.go:45 +0x25f
cmd/compile/internal/noder.(*irgen).funcDecl.func1()
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/decl.go:143 +0xf5
cmd/compile/internal/noder.(*irgen).generate(0xc000396540, {0xc000071920, 0xb, 0x203000?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/irgen.go:280 +0x227
cmd/compile/internal/noder.check2({0xc000071920, 0xb, 0xb})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/irgen.go:92 +0x16d
cmd/compile/internal/noder.LoadPackage({0xc0000bc100, 0xb, 0x0?})
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/noder/noder.go:90 +0x335
cmd/compile/internal/gc.Main(0xd46330)
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/internal/gc/main.go:191 +0xb13
main.main()
        /home/johejo/ghq/github.com/golang/go/src/cmd/compile/main.go:55 +0xdd

Other reproductions

related #47631
560dc97

@cuonglm
Copy link
Member

cuonglm commented Nov 16, 2021

Minimal reproducer:

package p

func f() {
	var ()
}

@cuonglm cuonglm added the NeedsFix The path to resolution is known, but the work has not been done. label Nov 16, 2021
@cuonglm cuonglm added this to the Go1.18 milestone Nov 16, 2021
@gopherbot
Copy link

gopherbot commented Nov 16, 2021

Change https://golang.org/cl/364314 mentions this issue: cmd/compile: prevent irgen crashing for empty local declaration stmt

@golang golang locked and limited conversation to collaborators Nov 16, 2022
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

3 participants