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
constshiftBound=1023-1+52
which permits the expression
smallestFloat64=1.0/ (1<<(1023-1+52))
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
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: