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

Signed integer cast panics #2854

Closed
kevaundray opened this issue Sep 26, 2023 · 0 comments · Fixed by #2869
Closed

Signed integer cast panics #2854

kevaundray opened this issue Sep 26, 2023 · 0 comments · Fixed by #2869
Assignees
Labels
bug Something isn't working

Comments

@kevaundray
Copy link
Contributor

Aim

This was reported by a user named Peter in Discord.

The following program will panic:

fn main(x: Field) -> pub i127 {
    x as i127
}

with

The application panicked (crashed).
Message:  assertion failed: bits + bit_size < FieldElement::max_num_bits()
Location: compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/generated_acir.rs:602

Whereas doing:

fn main(x: Field) -> pub i127 {
    (x as u126) as i127
}

Will pass.

Expected Behavior

.

Bug

.

To Reproduce

Installation Method

None

Nargo Version

No response

Additional Context

No response

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@kevaundray kevaundray added the bug Something isn't working label Sep 26, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Sep 26, 2023
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants