-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Description
What did you do?
I tried to compile the following program, but it caused the compiler to hang indefinitely:
package main
func main() {}
type I interface {
M1() interface {
I
}
M2() interface {
I
}
}If you remove either of the two interface method definitions (M1 or M2), it compiles. Furthermore, it seems to exhibit the same behavior whether the anonymous interfaces are for the method return types, parameter types, or a mixture of the two.
Go Playground: https://play.golang.org/p/UkT9bStm3tR (After the first run on the Go Playground, which hung until it timed out, the playground started responding immediately with what appears to be a cached error message).
Github: https://github.com/nathanjcochran/hung-compiler
go get -d github.com/nathanjcochran/hung-compiler
go install github.com/nathanjcochran/hung-compiler # Hangs indefinitely
What did you expect to see?
I expected it to compile.
What did you see instead?
The compiler hangs indefinitely.
Does this issue reproduce with the latest release (go1.10.2)?
I tried it with go1.10.1, but not go1.10.2
EDIT: I tried it with go1.10.2, and it still hung indefinitely
System details
go version go1.10.1 linux/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/nathan/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/nathan/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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-build836785314=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version go1.10.1 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.10.1
uname -sr: Linux 4.4.0-122-generic
LSB Version: core-9.20160110ubuntu0.2-amd64:core-9.20160110ubuntu0.2-noarch:security-9.20160110ubuntu0.2-amd64:security-9.20160110ubuntu0.2-noarch
Distributor ID: LinuxMint
Description: Linux Mint 18 Sarah
Release: 18
Codename: sarah
/lib/x86_64-linux-gnu/libc.so.6: GNU C Library (Ubuntu GLIBC 2.23-0ubuntu10) stable release version 2.23, by Roland McGrath et al.
gdb --version: GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1