Skip to content

fix(ssa): Slice mergers with multiple ifs#2597

Merged
jfecher merged 5 commits intomasterfrom
mv/fix-get-slice-len
Sep 7, 2023
Merged

fix(ssa): Slice mergers with multiple ifs#2597
jfecher merged 5 commits intomasterfrom
mv/fix-get-slice-len

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
@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