-
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
Mem2Reg pass may produce incorrect code when mutable references are aliased #2316
Comments
The annotations aren't quite correct:
Looking at
I'm still investigating this since from this SSA alone I'm not sure why it is not working. Perhaps it is broken by a later pass. Edit: I've confirmed the generated SSA is good through inlining until mem2reg where it does not track the aliases properly. |
Waiting until after #2243 to start on changing mem2reg to support alias analysis since both that PR and this change would change the mem2reg pass considerably they'd be difficult to merge otherwise. |
Aim
In the following code, after the call to
increment
the value of x remains unchanged:This bug is very similar to (possibly the same as) #2255, but there the mutable variable of type MutRef is a parameter, and here it's a local.
The SSA for increment is correct, the bug is in main:
Expected Behavior
the example proves properly
Bug
it doesn't
To Reproduce
No response
Installation Method
Compiled from source
Nargo Version
No response
Additional Context
No response
Would you like to submit a PR for this Issue?
Yes
Support Needs
No response
The text was updated successfully, but these errors were encountered: