Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions compiler/noirc_evaluator/src/acir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1392,22 +1392,21 @@ impl<'a> Context<'a> {
// Get operations to call-data parameters are replaced by a get to the call-data-bus array
let call_data =
self.data_bus.call_data.iter().find(|cd| cd.index_map.contains_key(&array)).cloned();
if let Some(call_data) = call_data {
let mut value = if let Some(call_data) = call_data {
let call_data_block = self.ensure_array_is_initialized(call_data.array_id, dfg)?;
let bus_index = self
.acir_context
.add_constant(FieldElement::from(call_data.index_map[&array] as i128));
let mut current_index = self.acir_context.add_var(bus_index, var_index)?;
let result = self.get_from_call_data(&mut current_index, call_data_block, &res_typ)?;
self.define_result(dfg, instruction, result.clone());
return Ok(result);
}
// Compiler sanity check
assert!(
!res_typ.contains_slice_element(),
"ICE: Nested slice result found during ACIR generation"
);
let mut value = self.array_get_value(&res_typ, block_id, &mut var_index)?;
self.get_from_call_data(&mut current_index, call_data_block, &res_typ)?
} else {
// Compiler sanity check
assert!(
!res_typ.contains_slice_element(),
"ICE: Nested slice result found during ACIR generation"
);
self.array_get_value(&res_typ, block_id, &mut var_index)?
};

if let AcirValue::Var(value_var, typ) = &value {
let array_typ = dfg.type_of_value(array);
Expand Down
6 changes: 6 additions & 0 deletions test_programs/execution_success/regression_7612/Nargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "regression_7612"
type = "bin"
authors = [""]

[dependencies]
2 changes: 2 additions & 0 deletions test_programs/execution_success/regression_7612/Prover.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
array = [{ counter = 8, fields = ["0x200000000"] }]
x = true
11 changes: 11 additions & 0 deletions test_programs/execution_success/regression_7612/src/main.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pub struct Data {
fields: [Field; 1],
counter: u32,
}

fn main(array: call_data(0) [Data; 1], x: bool) {
let index = if x { 0 } else { 1 };
if index != 0 {
assert(array[index - 1].counter < 3);
}
}
Loading