noir icon indicating copy to clipboard operation
noir copied to clipboard

ICE: unreachable code

Open nventuro opened this issue 1 year ago • 3 comments

Aim

I run into an ICE while performing routine development.

Expected Behavior

I expected to not run into an ICE?

Bug

I get the following error message:

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

I produced a relatively minimal example, in which calling a trivial unconstrained function triggers the ICE, and calling a copy of that function that is constrained does not.

To Reproduce

The example can be found in this commit.

  1. git checkout a3b17b9472677e967651886f1fd2cff4d9f76ef8
  2. cd noir-projects/noir-contracts/
  3. nargo compile --package ice_contract --silence-warnings
  4. cry

If the call to view_notes is commented out and the call to view_notes_constrained is uncommented, there's no compilation error. Both functions are identical except for the unconstrained modifier.

Project Impact

Blocker

Impact Context

No response

Workaround

None

Workaround Description

No response

Additional Context

No response

Installation Method

Compiled from source

Nargo Version

nargo version = 0.24.0 noirc version = 0.24.0+edaef211ea08832b1aaabcfc8b3f2419c3a2184c (git version hash: edaef211ea08832b1aaabcfc8b3f2419c3a2184c, is dirty: false)

NoirJS Version

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

nventuro avatar Mar 06 '24 21:03 nventuro

@nventuro would you be able to come up with a minimal reproduction that relies less on Aztec.nr? That'd be super helpful to ease our further debugging.

Savio-Sou avatar Mar 08 '24 16:03 Savio-Sou

I was unable - I tried replicating this by creating a second crate and calling a function declared there, but doing so I ended up triggering a different ICE: see https://github.com/noir-lang/noir/issues/4517.

The original example shown here does not rely that much on aztec-nr however, even though there's a contract etc., no library code is called.

nventuro avatar Mar 08 '24 20:03 nventuro

Ah sorry I meant also and perhaps more importantly Aztec macros, not just Aztec.nr.

As there could be the possibility that the bug lies within the macros, it'd be great to get a macro-less reproduction to better identify where the problem lies.

Savio-Sou avatar Mar 11 '24 17:03 Savio-Sou

Closing this as this seems to be more of an aztec_macros issue than Noir.

TomAFrench avatar Apr 20 '24 23:04 TomAFrench