cmd/compile, types2: consider increasing the internal precision limit for integer values #44057
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
The compiler restricts untyped integer constants to a maximum of 512 bits (implementation restriction). It also has a (separate) and higher limit on shift counts for constant shifts. The shift limit is currently set to
which permits the expression
However, while the shift count check succeeds, the shift result overflows as the integer value
1<<(1023 - 1 + 52)
(before conversion to the untyped float) exceeds 512 bits.Consider increasing the bit limit for untyped integer constants to 1100 (or the like). Then we can express these constants
exactly (as in rational numbers used by
go/constant
).The change should be trivial but it will likely affect tests that expect an error at lower bounds.
If the change is made, it should be made in the compiler (
typecheck/constant/go
) andtypes2
(expr.go
).cc: @mdempsky
The text was updated successfully, but these errors were encountered: