-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: internal compiler error: got untyped bool for autotmp #17551
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
Comments
This appears to be a side-effect of 6286188. |
Thanks for the concise test case. In my (somewhat long) queue. |
@josharian I had to extract it from the code I've been working on. Glad to be able to help :) |
Interestingly the bug only manifests with a named return signature 6c6
< func Y() (int, bool) {
---
> func Y() (i int, ok bool) { Passespackage main
func main() {
_, y := Y()
if y {}
}
func Y() (int, bool) {
ii := int(1)
return ii, 0 <= ii && ii < 20
} Failspackage main
func main() {
_, _ = Y()
}
func Y() (i int, ok bool) {
ii := int(1)
return ii, 0 <= ii && ii < 20
} ./fails.go:8: internal compiler error: got untyped bool for autotmp_2
goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/runtime/debug/stack.go:24 +0x79
cmd/compile/internal/gc.Fatalf(0x644b18, 0xd, 0xc42031d540, 0x2, 0x2)
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/cmd/compile/internal/gc/subr.go:165 +0x226
cmd/compile/internal/gc.typecheckdef(0xc4203655f0, 0xc42031d640)
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/cmd/compile/internal/gc/typecheck.go:3782 +0x488
cmd/compile/internal/gc.typecheck1(0xc4203655f0, 0x22, 0xc420356520)
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/cmd/compile/internal/gc/typecheck.go:266 +0xca51
cmd/compile/internal/gc.typecheck(0xc4203655f0, 0x22, 0x4e7e9f)
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/cmd/compile/internal/gc/typecheck.go:188 +0x602
cmd/compile/internal/gc.typecheckas(0xc420365680)
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/cmd/compile/internal/gc/typecheck.go:3253 +0x78
cmd/compile/internal/gc.typecheck1(0xc420365680, 0x1, 0x690bf4)
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/cmd/compile/internal/gc/typecheck.go:1963 +0x37ce
cmd/compile/internal/gc.typecheck(0xc420365680, 0x1, 0xc4203654d0)
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/cmd/compile/internal/gc/typecheck.go:188 +0x602
cmd/compile/internal/gc.copyexpr(0xc4203654d0, 0xc4200189c0, 0xc4203566d0, 0x10)
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/cmd/compile/internal/gc/subr.go:1336 +0x68
cmd/compile/internal/gc.cheapexpr(0xc4203654d0, 0xc4203566d0, 0x10)
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/cmd/compile/internal/gc/subr.go:1350 +0x5d
cmd/compile/internal/gc.safeexpr(0xc4203654d0, 0xc4203566d0, 0xc420349dd0)
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/cmd/compile/internal/gc/subr.go:1330 +0x1fd
cmd/compile/internal/gc.walkexprlistsafe(0xc420012c80, 0x2, 0x2, 0xc4203566d0)
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/cmd/compile/internal/gc/walk.go:401 +0x56
cmd/compile/internal/gc.walkstmt(0xc4203566c0, 0xc4203565a0)
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/cmd/compile/internal/gc/walk.go:337 +0x478
cmd/compile/internal/gc.walkstmtlist(0xc420335600, 0x5, 0x8)
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/cmd/compile/internal/gc/walk.go:80 +0x44
cmd/compile/internal/gc.walk(0xc4203498c0)
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/cmd/compile/internal/gc/walk.go:65 +0x1c0
cmd/compile/internal/gc.compile(0xc4203498c0)
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/cmd/compile/internal/gc/pgen.go:347 +0x1c5
cmd/compile/internal/gc.funccompile(0xc4203498c0)
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/cmd/compile/internal/gc/dcl.go:1303 +0xdc
cmd/compile/internal/gc.Main()
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/cmd/compile/internal/gc/main.go:476 +0x1f50
main.main()
/Users/emmanuelodeke/go/src/go.googlesource.com/go/src/cmd/compile/main.go:47 +0x15d |
@odeke-em yeah, I mentioned it in the issue. Error does not occur when there is single named bool returned. Also, these combinations will work:
So probably as @0xmohit mentioned it's a side effect of optimization introduced in 6286188 |
CL https://golang.org/cl/31857 mentions this issue. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version devel +eb15cf1 Sat Oct 22 01:23:14 2016 +0000 darwin/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
This is minimal example I've been able to create to reproduce this error (works in go 1.7.3):
What did you expect to see?
What did you see instead?
Works with:
return ii, bool(0 <= ii && ii <= 0x7fffffff)
func X() (int, bool)
The text was updated successfully, but these errors were encountered: