diff --git a/tooling/ast_fuzzer/src/program/func.rs b/tooling/ast_fuzzer/src/program/func.rs index ed96760ef6f..23b759f147d 100644 --- a/tooling/ast_fuzzer/src/program/func.rs +++ b/tooling/ast_fuzzer/src/program/func.rs @@ -737,11 +737,14 @@ impl<'a> FunctionContext<'a> { max_depth: usize, ) -> arbitrary::Result> { // Collect the operations can return the expected type. + // Avoid operations that can fail in no-dynamic mode, otherwise they will be considered non-constant indexes. let ops = BinaryOp::iter() .filter(|op| { types::can_binary_op_return(op, typ) - && (!self.ctx.config.avoid_overflow || !types::can_binary_op_overflow(op)) - && (!self.ctx.config.avoid_err_by_zero || !types::can_binary_op_err_by_zero(op)) + && (!(self.ctx.config.avoid_overflow || self.in_no_dynamic) + || !types::can_binary_op_overflow(op)) + && (!(self.ctx.config.avoid_err_by_zero || self.in_no_dynamic) + || !types::can_binary_op_err_by_zero(op)) }) .collect::>();