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

Mem2reg block parameter aliases handled incorrectly #6474

Closed
jfecher opened this issue Nov 7, 2024 · 0 comments · Fixed by #6477
Closed

Mem2reg block parameter aliases handled incorrectly #6474

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

Comments

@jfecher
Copy link
Contributor

jfecher commented Nov 7, 2024

Aim

unconstrained fn main(mut x: i32) {
    mutate_alias(&mut x, &mut x);
    assert_eq(x, 1);
}

unconstrained fn mutate_alias(x: &mut i32, y: &mut i32) {
    *x = 0;
    *y = 1;
    assert_eq(*x, 1);
}

Expected Behavior

The test to pass

Bug

Test fails because we wrongly optimize the assert_eq(*x, 1) to assert_eq(0, 1), wrongly assuming that x can't be aliased to y.

To fix this, parameters should be pessimistically assumed to be aliases to all other parameters.

To Reproduce

Workaround

None

Workaround Description

No response

Additional Context

No response

Project Impact

None

Blocker Context

No response

Nargo Version

No response

NoirJS Version

No response

Proving Backend Tooling & 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 Nov 7, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Nov 7, 2024
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Nov 8, 2024
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
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

1 participant