Skip to content

Commit

Permalink
fix: Fix subtract with underflow in flattening pass (#2796)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfecher authored Sep 22, 2023
1 parent 7b80f0e commit f2ed505
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/noirc_evaluator/src/ssa/opt/flatten_cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ impl<'f> Context<'f> {
let mut get_element = |array, typevars, len| {
// The smaller slice is filled with placeholder data. Codegen for slice accesses must
// include checks against the dynamic slice length so that this placeholder data is not incorrectly accessed.
if (len - 1) < index_value.to_u128() as usize {
if len <= index_value.to_u128() as usize {
let zero = FieldElement::zero();
self.inserter.function.dfg.make_constant(zero, Type::field())
} else {
Expand Down

0 comments on commit f2ed505

Please sign in to comment.