diff --git a/compiler/noirc_evaluator/src/ssa/interpreter/intrinsics.rs b/compiler/noirc_evaluator/src/ssa/interpreter/intrinsics.rs index 371919bb524..a084d853e3f 100644 --- a/compiler/noirc_evaluator/src/ssa/interpreter/intrinsics.rs +++ b/compiler/noirc_evaluator/src/ssa/interpreter/intrinsics.rs @@ -454,7 +454,12 @@ impl Interpreter<'_, W> { } Intrinsic::ArrayRefCount | Intrinsic::SliceRefCount => { let array = self.lookup_array_or_slice(args[0], "array/slice ref count")?; - let rc = *array.rc.borrow(); + let mut rc = *array.rc.borrow(); + // ACIR always returns 0 for the refcounts, and we expect that IncRc and DecRc don't appear in constrained SSA. + // The interpreter starts with a default ref-count value of 1. If it did not change, treat it as zero to match ACIR. + if !self.in_unconstrained_context() && rc == 1 { + rc = 0; + } Ok(vec![Value::from_constant(rc.into(), NumericType::unsigned(32))?]) } }