Make the subtract lazy in the icache fuzz target (#4732)

This unchecked, always-performed subtract *could* be the cause of #4731,
if the immediate was 0 in the first place.
This commit is contained in:
Benjamin Bouvier
2022-08-18 19:03:08 +02:00
committed by GitHub
parent 0a71df6a37
commit 7d9a359f51

View File

@@ -96,7 +96,7 @@ fuzz_target!(|func: SingleFunction| {
let imm = imm.bits(); let imm = imm.bits();
cursor.func.dfg[inst] = ir::InstructionData::UnaryImm { cursor.func.dfg[inst] = ir::InstructionData::UnaryImm {
opcode: ir::Opcode::Iconst, opcode: ir::Opcode::Iconst,
imm: Imm64::new(imm.checked_add(1).unwrap_or(imm - 1)), imm: Imm64::new(imm.checked_add(1).unwrap_or_else(|| imm - 1)),
}; };
} else { } else {
cursor.func.dfg[inst] = ir::InstructionData::UnaryImm { cursor.func.dfg[inst] = ir::InstructionData::UnaryImm {