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(ssa): Slice mergers with multiple ifs #2597

Merged
merged 5 commits into from
Sep 7, 2023
Merged

Conversation

vezenovm
Copy link
Contributor

@vezenovm vezenovm commented Sep 7, 2023

Description

Problem*

Resolves

No issue as this was found and quickly patched as part of #374

Summary*

The handling of get_slice_length was incorrect in that for some instruction cases it used the slice capacity (the total number of slice elements in an array value) and in some cases it used the slice length prefix. During slice merger we should only ever use the capacity. The length is to be used only for checking against user out of bounds accesses. This was not a problem in the existing tests, but when trying to do a push back outside of an if statement where there was a slice merger we get mismatched slice values as the length is not correct.

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.

@vezenovm vezenovm marked this pull request as ready for review September 7, 2023 16:12
@vezenovm
Copy link
Contributor Author

vezenovm commented Sep 7, 2023

I have made #2599 as even though we can merge slices with multiple if statements, currently there is a bug if there is not an explicit else case.

@jfecher jfecher added this pull request to the merge queue Sep 7, 2023
Merged via the queue into master with commit 6110638 Sep 7, 2023
13 checks passed
@jfecher jfecher deleted the mv/fix-get-slice-len branch September 7, 2023 18:35
TomAFrench added a commit that referenced this pull request Sep 7, 2023
* master:
  fix(ssa): Slice mergers with multiple ifs (#2597)
  chore: remove usage of `serial_test` dependency (#2598)
  fix: Implement auto-dereferencing when calling methods (#2581)
  chore(noir): Release 0.11.1 (#2594)
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.

2 participants