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

== panics on slices #4506

Closed
jfecher opened this issue Mar 7, 2024 · 0 comments · Fixed by #4507
Closed

== panics on slices #4506

jfecher opened this issue Mar 7, 2024 · 0 comments · Fixed by #4507
Assignees
Labels
bug Something isn't working

Comments

@jfecher
Copy link
Contributor

jfecher commented Mar 7, 2024

Aim

This bug was found by @michaeljklein and seems to trigger when checking equality on any slice:

fn main() {
    let slice = [1, 2, 3];
    assert(slice == slice);
}

Expected Behavior

The program to prove and verify

Bug

The application panicked (crashed).
Message:  into_leaf called on a Tree::Branch
Location: compiler/noirc_evaluator/src/ssa/ssa_gen/value.rs:160

This is a bug. We may have already fixed this in newer versions of Nargo so try searching for similar issues at
 https://github.com/noir-lang/noir/issues/.
If there isn't an open issue for this bug, consider opening one at https://github.com/noir-lang/noir/issues/new
?labels=bug&template=bug_report.yml
exit 101

To Reproduce

Project Impact

None

Impact Context

No response

Workaround

None

Workaround Description

No response

Additional Context

No response

Installation Method

None

Nargo Version

No response

NoirJS Version

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

@jfecher jfecher added the bug Something isn't working label Mar 7, 2024
@jfecher jfecher assigned vezenovm and jfecher and unassigned vezenovm Mar 7, 2024
github-merge-queue bot pushed a commit that referenced this issue Mar 7, 2024
# Description

## Problem\*

Resolves #4506

## Summary\*

`==` on slices previously tried to use the built-in impl we have but
this leads to a panic when evaluating binary operators in SSA. We expect
both sides of the binary to be non-tuples but this isn't true for slice
values. Instead of making this work for tuples I changed the type
checker to force slices to use the stdlib impl we have for `==` rather
than the built in one.

## Additional Context



## Documentation\*

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[Exceptional Case]** Documentation to be submitted in a separate
PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
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