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?
to your account
The compiler reports an error if a constant literal is too large to represent, but it doesn't if we exceed that value in constant arithmetic.
The text was updated successfully, but these errors were encountered:
It looks like we incorrectly allow infinity as a constant, but we correctly error about any attempts to turn it into a typed value.
I think my CLs to switch cmd/compile to use go/constant should fix this.
Sorry, something went wrong.
At tip (of dev.regabi) we now ICE instead, because of the failure to report an error message.
Relatedly, I realized I missed that XOR can also cause overflow, so this currently ICEs as well while trying to report the overflow error:
const MaxInt512 = (1<<256 - 1) * (1<<256 + 1)
const _ = ^MaxInt512 // computes -1 << 512
Change https://golang.org/cl/272928 mentions this issue: [dev.regabi] cmd/compile: fix reporting of overflow
[dev.regabi] cmd/compile: fix reporting of overflow
Successfully merging a pull request may close this issue.