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: missing truncation error #20750
Comments
Simpler
Spec says every implementation must:
Maybe the |
@ALTree is correct. Per the spec (https://tip.golang.org/ref/spec#Constants): Implementation restriction: Although numeric constants have arbitrary precision in the language, a compiler may implement them using an internal representation with limited precision. That said, every implementation must:
go/types uses rational numbers for constants and doesn't round (the result is always exact *). Thus, (* There's an escape hatch where even go/types moves to a big.Float representation in situations where the rational number components become so large as to make it practically impossible for the compiler to finish constant arithmetic in a reasonable amount of time, but that only kicks in in extreme cases). Closing as implementation restriction. |
gotype says:
cmd/compile (1.7, 1.8, 1.9beta1) accepts the code.
Found with go-fuzz. cc @dvyukov @griesemer
The text was updated successfully, but these errors were encountered: