diff --git a/compiler/noirc_evaluator/src/acir/acir_context/mod.rs b/compiler/noirc_evaluator/src/acir/acir_context/mod.rs index 1680f48449f..3c95cf2a125 100644 --- a/compiler/noirc_evaluator/src/acir/acir_context/mod.rs +++ b/compiler/noirc_evaluator/src/acir/acir_context/mod.rs @@ -773,7 +773,7 @@ impl> AcirContext { // If `lhs` and `rhs` are known constants then we can calculate the result at compile time. // `rhs` must be non-zero. - (Some(lhs_const), Some(rhs_const), _) if !rhs_const.is_zero() => { + (Some(lhs_const), Some(rhs_const), _) if rhs_const.to_u128() != 0 => { let quotient = lhs_const.to_u128() / rhs_const.to_u128(); let remainder = lhs_const.to_u128() - quotient * rhs_const.to_u128(); diff --git a/test_programs/compile_success_with_bug/regression_8175/Nargo.toml b/test_programs/compile_success_with_bug/regression_8175/Nargo.toml new file mode 100644 index 00000000000..06db4cbebc2 --- /dev/null +++ b/test_programs/compile_success_with_bug/regression_8175/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "regression_8175" +type = "bin" +authors = [""] + +[dependencies] diff --git a/test_programs/compile_success_with_bug/regression_8175/Prover.toml b/test_programs/compile_success_with_bug/regression_8175/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test_programs/compile_success_with_bug/regression_8175/src/main.nr b/test_programs/compile_success_with_bug/regression_8175/src/main.nr new file mode 100644 index 00000000000..e0fbff9972c --- /dev/null +++ b/test_programs/compile_success_with_bug/regression_8175/src/main.nr @@ -0,0 +1,4 @@ +fn main() -> pub bool { + let d = ((false as Field) / (false as Field)); + (d as u128) == 0 +}