-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
VM doesn't handle properly uint64 with high bit set (except when from a literal).
Example
proc fun(): uint = cast[uint](-1)
const x0 = fun()
discard $x0 # Error: cannot convert -1 to uint64; ditto with echo x0
const x1 = cast[uint](-1)
discard $x1 # ditto
# workaround (not a real workaround since we can't get the string at CT)
let x0b = x0
discard $x0b # this works
const x2 = 18446744073709551615'u
discard $x2 # works in devel, CT error 0.20.2: Error: number out of range: '18446744073709551615'u'Current Output
Error: cannot convert -1 to uint64
Expected Output
works
Additional Information
- It was working in version 0.20.2 (except for 3rd case
x2, which works in devel but not 0.20.2) - broken in devel 6e0c06f and since 1.0.0
- related but different (since closed and working):
VM rejects tuples containing uint64 with high bit set #11084
Cannot print unsigned integer constant #6838
juancarlospaco
Metadata
Metadata
Assignees
Labels
No labels