-
Notifications
You must be signed in to change notification settings - Fork 219
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
Multiple slice mergers requires equal size slices #2599
Comments
This looks to be not that the For example taking a simpler snippet of above:
When we merge the first if statement we have a |
So in order to be able to handle multiple slice mergers of varying size we need check the tracked user facing slice length against the actual slice capacity when simplifying or codegen'ing slice intrinsics. These checks and their result need to be codegen'd In order to implement this fix we will need to do what is stated below:
I have a proof of concept that fixes the snippets posted in this issue, but I have only tested and implemented push_back so far. In order to implement push_back for the PoC, step 2 had to be implemented so that is complete already. The main challenge looks like it will be getting slice insert and slice remove correct as they do not simply add on or remove elements from the end of slice, but rather anywhere in the slice. I think these should be tackled next to determine the feasibility of this solution. It may be also worth it to discuss whether it is worth it to return to mutable arrays in SSA if this solution is deemed too complex (or flat out unsound). |
Aim
I have this program where the first if case is hit and the second else-case is hit:
I should be able to write it like this:
Expected Behavior
We should have a resulting slice in both cases like this:
0x00, 0x00, 0x0a, 0x05, 0x0f, 0x1e
.Bug
However, when checking the values like such:
The second snippet has the wrong values assigned to the slice. Specifically, printing all fix values we get
0x00, 0x00, 0x0a, 0x05, 0x00, 0x0f
, and thus the assertion will fail.To Reproduce
Installation Method
Compiled from source
Nargo Version
nargo 0.11.0 (git version hash: 2728851, is dirty: true)
Additional Context
No response
Would you like to submit a PR for this Issue?
No
Support Needs
No response
The text was updated successfully, but these errors were encountered: