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

Panic when mutating arrays of mutable references #2221

Closed
jfecher opened this issue Aug 8, 2023 · 2 comments
Closed

Panic when mutating arrays of mutable references #2221

jfecher opened this issue Aug 8, 2023 · 2 comments
Assignees
Labels
bug Something isn't working ssa

Comments

@jfecher
Copy link
Contributor

jfecher commented Aug 8, 2023

Aim

fn main(x: bool) {
    let ref = &mut 0;
    let mut array = [ref, ref];

    if x {
        *array[0] = 1;
    } else {
        *array[0] = 2;
    }

    dep::std::println(*array[0]);
}

Expected Behavior

An output of 0x01 or 0x02

Bug

The compiler panics:

The application panicked (crashed).
Message:  internal error: entered unreachable code: Expected all allocate instructions to be removed before acir_gen
Location: crates/noirc_evaluator/src/ssa/acir_gen/mod.rs:420

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

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 13 frames hidden ⋮                              
  14: noirc_evaluator::ssa::acir_gen::Context::convert_ssa_instruction::hfe9df5b802d1aa68
      at /.../noir/crates/noirc_evaluator/src/ssa/acir_gen/mod.rs:420
  15: noirc_evaluator::ssa::acir_gen::Context::convert_acir_main::h484c2ec837738bfc
      at /.../noir/crates/noirc_evaluator/src/ssa/acir_gen/mod.rs:183
  16: noirc_evaluator::ssa::acir_gen::Context::convert_ssa::h74680bc78f4648b9
      at /.../noir/crates/noirc_evaluator/src/ssa/acir_gen/mod.rs:166
  17: noirc_evaluator::ssa::acir_gen::<impl noirc_evaluator::ssa::ssa_gen::program::Ssa>::into_acir::h971b88db242e6969
      at /.../noir/crates/noirc_evaluator/src/ssa/acir_gen/mod.rs:118
  18: noirc_evaluator::ssa::optimize_into_acir::hd75a45ce4888f118
      at /.../noir/crates/noirc_evaluator/src/ssa.rs:66
  19: noirc_evaluator::ssa::create_circuit::h413f0a3f36ec55d9
      at /.../noir/crates/noirc_evaluator/src/ssa.rs:85
  20: noirc_driver::compile_no_check::h375ae18c879761bf
      at /.../noir/crates/noirc_driver/src/lib.rs:274
  21: noirc_driver::compile_main::h9be042dd6a620392
      at /.../noir/crates/noirc_driver/src/lib.rs:164
  22: nargo_cli::cli::compile_cmd::compile_package::h4808d61fb3cbf6ea
      at /.../noir/crates/nargo_cli/src/cli/compile_cmd.rs:133
  23: nargo_cli::cli::prove_cmd::prove_package::h47bcb14dac611c80
      at /.../noir/crates/nargo_cli/src/cli/prove_cmd.rs:99
  24: nargo_cli::cli::prove_cmd::run::h5b3f377bf98277c3
      at /.../noir/crates/nargo_cli/src/cli/prove_cmd.rs:63
  25: nargo_cli::cli::start_cli::h1807e845f5e58191
      at /.../noir/crates/nargo_cli/src/cli/mod.rs:80
  26: nargo::main::h2898770d02bc5bf3
      at /.../noir/crates/nargo_cli/src/main.rs:14
  27: core::ops::function::FnOnce::call_once::hc97adbc66f267ff4
      at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/ops/function.rs:251
                                ⋮ 13 frames hidden ⋮                              
exit 101

To Reproduce

Installation Method

None

Nargo Version

No response

Additional Context

No response

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@vezenovm
Copy link
Contributor

vezenovm commented Aug 30, 2023

We can close this now? @jfecher

@jfecher
Copy link
Contributor Author

jfecher commented Aug 30, 2023

Fixed by #2464

@jfecher jfecher closed this as completed Aug 30, 2023
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ssa
Projects
Archived in project
Development

No branches or pull requests

2 participants