We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The following program:
package p func F() { switch t := nil.(type) { default: _ = t } }
crashes the go1.7.5, go1.8.1 and tip compilers with the following error:
# command-line-arguments ./prova.go:4: cannot type switch on non-interface value nil ./prova.go:4: internal compiler error: got nil for t goroutine 1 [running]: runtime/debug.Stack(0x0, 0x0, 0x0) /usr/local/go/src/runtime/debug/stack.go:24 +0x79 cmd/compile/internal/gc.Fatalf(0xaba22d, 0xd, 0xc420309a18, 0x2, 0x2) /usr/local/go/src/cmd/compile/internal/gc/subr.go:167 +0x226 cmd/compile/internal/gc.typecheckdef(0xc420338f30, 0xc42001f560) /usr/local/go/src/cmd/compile/internal/gc/typecheck.go:3781 +0x41a cmd/compile/internal/gc.typecheck1(0xc420338f30, 0x22, 0x90) /usr/local/go/src/cmd/compile/internal/gc/typecheck.go:266 +0xdd5b cmd/compile/internal/gc.typecheck(0xc420338f30, 0x22, 0xc42030aab0) /usr/local/go/src/cmd/compile/internal/gc/typecheck.go:188 +0x608 cmd/compile/internal/gc.typecheckswitch(0xc420338c60) /usr/local/go/src/cmd/compile/internal/gc/swt.go:185 +0x2b8 cmd/compile/internal/gc.typecheck1(0xc420338c60, 0x1, 0x4) /usr/local/go/src/cmd/compile/internal/gc/typecheck.go:2068 +0xc7a8 cmd/compile/internal/gc.typecheck(0xc420338c60, 0x1, 0x3) /usr/local/go/src/cmd/compile/internal/gc/typecheck.go:188 +0x608 cmd/compile/internal/gc.typecheckslice(0xc42000c588, 0x1, 0x1, 0x1) /usr/local/go/src/cmd/compile/internal/gc/typecheck.go:49 +0x4e cmd/compile/internal/gc.Main() /usr/local/go/src/cmd/compile/internal/gc/main.go:374 +0x1938 main.main() /usr/local/go/src/cmd/compile/main.go:50 +0xfe
The text was updated successfully, but these errors were encountered:
/cc @mdempsky @griesemer @josharian
Sorry, something went wrong.
It happens with type switching on anything untyped:
const x = 1 func G() { switch t := x.(type) { default: } }
Testing a fix now.
@tzneal awesome. There's an outside chance that your fix might also address #19977 -- worth checking, anyway.
If it doesn't, I have a patch for #19977 (in fact, I found this bug while working on that one).
CL https://golang.org/cl/42210 mentions this issue.
cee5cd5
No branches or pull requests
The following program:
crashes the go1.7.5, go1.8.1 and tip compilers with the following error:
The text was updated successfully, but these errors were encountered: