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

go/types: crash on int64(-1<<63) % 1e6 #14229

Closed
alandonovan opened this issue Feb 4, 2016 · 3 comments
Closed

go/types: crash on int64(-1<<63) % 1e6 #14229

alandonovan opened this issue Feb 4, 2016 · 3 comments
Milestone

Comments

@alandonovan
Copy link
Contributor

% cat ~/a.go
package f
const _ = int64(-1<<63) % 1e6

% ssadump ~/a.go
panic: invalid binary operation -9.22337e+18 % 1e+06 [recovered]
panic: invalid binary operation -9.22337e+18 % 1e+06

goroutine 1 [running]:
go/types.(_Checker).handleBailout(0xc8200ac000, 0xc8200bf2d0)
/usr/local/google/home/adonovan/go/src/go/types/check.go:213 +0xd8
go/constant.BinaryOp(0x7fa1c5d35d20, 0xc820010cc0, 0x10, 0x7fa1c5d35d20, 0xc820010c80, 0x0, 0x0)
/usr/local/google/home/adonovan/go/src/go/constant/value.go:1110 +0x48c
go/types.(_Checker).binary(0xc8200ac000, 0xc820010bc0, 0xc820012d50, 0x7fa1c5d35b40, 0xc820010b00, 0x7fa1c5d35a98, 0xc82000ab20, 0x10)
/usr/local/google/home/adonovan/go/src/go/types/expr.go:815 +0x703
go/types.(_Checker).exprInternal(0xc8200ac000, 0xc820010bc0, 0x7fa1c5d35b08, 0xc820012d50, 0x0, 0x0, 0x7e)
/usr/local/google/home/adonovan/go/src/go/types/expr.go:1398 +0x2875
go/types.(_Checker).rawExpr(0xc8200ac000, 0xc820010bc0, 0x7fa1c5d35b08, 0xc820012d50, 0x0, 0x0, 0x0)
/usr/local/google/home/adonovan/go/src/go/types/expr.go:943 +0x7d
go/types.(_Checker).multiExpr(0xc8200ac000, 0xc820010bc0, 0x7fa1c5d35b08, 0xc820012d50)
/usr/local/google/home/adonovan/go/src/go/types/expr.go:1470 +0x63
go/types.(_Checker).expr(0xc8200ac000, 0xc820010bc0, 0x7fa1c5d35b08, 0xc820012d50)
/usr/local/google/home/adonovan/go/src/go/types/expr.go:1464 +0x3f
...

@griesemer
Copy link
Contributor

I have a (simple) fix for this but I want to think it through more carefully - will have to wait for tomorrow afternoon. We should probably accept this for 1.6 as it was introduced between 1.5 and 1.6 and it does prevent correct programs from type-checking.

@griesemer griesemer added this to the Go1.6 milestone Feb 5, 2016
@gopherbot
Copy link

CL https://golang.org/cl/19300 mentions this issue.

@alandonovan
Copy link
Contributor Author

I agree we should get this fix in ASAP. It causes any program that typechecks github.com/GoogleCloudPlatform/gcloud-golang/datastore (see time.go) to crash.

@golang golang locked and limited conversation to collaborators Feb 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants