diff --git a/compiler/noirc_evaluator/src/ssa/opt/bubble_up_constrains.rs b/compiler/noirc_evaluator/src/ssa/opt/bubble_up_constrains.rs index e0144005a0f..cb9519eeb2e 100644 --- a/compiler/noirc_evaluator/src/ssa/opt/bubble_up_constrains.rs +++ b/compiler/noirc_evaluator/src/ssa/opt/bubble_up_constrains.rs @@ -30,7 +30,7 @@ impl Ssa { // We iterate through the previous instructions in reverse order so the index is from the // back of the vector. Subtract from vector length to get correct index. .map(|reversed_index| filtered_instructions.len() - reversed_index) - .unwrap_or(filtered_instructions.len()); + .unwrap_or(0); filtered_instructions.insert(index, instruction); } diff --git a/test_programs/execution_success/bit_and/Prover.toml b/test_programs/execution_success/bit_and/Prover.toml index 40ce2b0bc27..34a5b63e5b1 100644 --- a/test_programs/execution_success/bit_and/Prover.toml +++ b/test_programs/execution_success/bit_and/Prover.toml @@ -1,2 +1,4 @@ x = "0x00" y = "0x10" +a = "0x00" +b = "0x10" diff --git a/test_programs/execution_success/bit_and/src/main.nr b/test_programs/execution_success/bit_and/src/main.nr index 0bc1d9a49bd..5a0aa17e3ed 100644 --- a/test_programs/execution_success/bit_and/src/main.nr +++ b/test_programs/execution_success/bit_and/src/main.nr @@ -1,6 +1,6 @@ // You can only do bit operations with integers. // (Kobi/Daira/Circom/#37) https://github.com/iden3/circom/issues/37 -fn main(x: Field, y: Field) { +fn main(x: Field, y: Field, a: Field, b: Field) { let x_as_u8 = x as u8; let y_as_u8 = y as u8; @@ -9,8 +9,8 @@ fn main(x: Field, y: Field) { let flag = (x == 0) & (y == 16); assert(flag); //bitwise and with odd bits: - let x_as_u11 = x as u11; - let y_as_u11 = y as u11; - assert((x_as_u11 & y_as_u11) == x_as_u11); + let a_as_u8 = a as u8; + let b_as_u8 = b as u8; + assert((a_as_u8 & b_as_u8) == a_as_u8); }