Skip to content
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

Big UInt128 literals don't work #7448

Closed
delef opened this issue Feb 17, 2019 · 6 comments
Closed

Big UInt128 literals don't work #7448

delef opened this issue Feb 17, 2019 · 6 comments
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler

Comments

@delef
Copy link
Contributor

delef commented Feb 17, 2019

1_329_227_995_784_915_872_903_807_060_280_344_576_u128

https://carc.in/#/r/6a2o

Invalid UInt64: 1329227995784915872903807060280344576 (ArgumentError)
from ???
from ???
from ???
from ???
from ???
from ???
from ???
from ???
from __crystal_main
from main
from __libc_start_main
from _start
from ???
Error: you've found a bug in the Crystal compiler. Please open an issue, including source code that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issues

But, I can get the same UInt128 from Slice(UInt8):

source = Bytes[1u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8]
pp source.reduce(0u128) { |r, v| (r << 8) | v } # => 1329227995784915872903807060280344576_u128

https://carc.in/#/r/6a6i

@delef delef changed the title Crystal compiler (UInt128) Crystal compiler bug (UInt128) Feb 17, 2019
@asterite
Copy link
Member

Yes, this is a known issue. See #5818 and #7015. Apparently those were closed without a good reason (it was never fixed and the PR that supposed to fix it is wrong (or at least not efficient as I'd like it to).

Let's keep this open to represent this issue.

@asterite asterite added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler labels Feb 17, 2019
@Sija
Copy link
Contributor

Sija commented Feb 18, 2019

There's #7093, as I understand waiting for the final touches. Would be great if it made it into 0.28.0 release.

@delef
Copy link
Contributor Author

delef commented Feb 18, 2019

@Sija No new commits for about two months.

@Sija
Copy link
Contributor

Sija commented Feb 18, 2019

@delef True, but that's the most complete PR to date.

@asterite asterite changed the title Crystal compiler bug (UInt128) Big UInt128 literals don't work May 8, 2019
@kojix2
Copy link
Contributor

kojix2 commented Aug 13, 2021

Int128 as well as UInt128.

@straight-shoota
Copy link
Member

This has been resolved by #11571

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler
Projects
None yet
Development

No branches or pull requests

5 participants