-
Notifications
You must be signed in to change notification settings - Fork 225
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
Compiler panics when trying to create a mutable reference of an undefined variable #1985
Comments
looks like you forgot to deref, but still get error in noir fn my_mutating_fn(a: &mut Field) {
*a += 10;
}
fn main(mut x: Field) -> pub Field {
my_mutating_fn(&mut a);
a
} $ nargo execute --show-ssa --experimental-ssa
The application panicked (crashed).
Message: index out of bounds: the len is 1254 but the index is 18446744073709551615
Location: crates/noirc_frontend/src/node_interner.rs:482
This is a bug. We may have already fixed this in newer versions of Nargo so try searching for similar issues at https://github.com/noir-lang/noir/issues/.
If there isn't an open issue for this bug, consider opening one at https://github.com/noir-lang/noir/issues/new?labels=bug&template=bug_report.yml |
Doh! Good catch. |
Thanks for the crash report, I've fixed it locally and will have a PR up soon. The issue is that in
|
&mut Field
and Field
Looking at the original code again, it uses @iAmMichaelConnor I would expect your code to work then with only adding the one dereference. Note that you need this dereference because, like in rust, references are separate from their element types. So you cannot add together a |
This isn't blocking anything, so not a high priority. It's just something I stumbled upon.
I'd have expected
+
to work here.Compiled using the latest
master
, from source.The text was updated successfully, but these errors were encountered: