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

fix: display correct range for u128 in OverflowingAssignment error #2638

Closed
wants to merge 1 commit into from

Conversation

TomAFrench
Copy link
Member

Description

Problem*

Resolves #2623

Summary*

This PR addresses an overflow which was occurring when calculating the maximum value of a u128. We now special case u128 and only calculate the maximum for smaller types.

Documentation

  • This PR requires documentation updates when merged.

    • I will submit a noir-lang/docs PR.
    • I will request for and support Dev Rel's help in documenting this PR.

Additional Context

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

Copy link
Contributor

@vezenovm vezenovm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the right error to display for u128. Our max supported integer size is u127. We have an UnsupportedIntegerSize runtime error that we handle when converting SSA bianry ops to ACIR. We should do the same thing for assignments and binary ops in SSA as well. Until we have improved general overflow checks in SSA this special case should just check the annotated type against the bit count and return an UnsupportedIntegerSize in the type check.

@kevaundray
Copy link
Contributor

What is that status of this fix?

@TomAFrench TomAFrench deleted the tf/correct-overflow-error-msg branch November 20, 2024 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect range of u128
3 participants