Skip to content

Commit

Permalink
cranelift: Fix fuzzgen iconst encoding (#6967)
Browse files Browse the repository at this point in the history
Resolves #6965
Linked to #3059 #6850 #6958

Co-authored-by: Afonso Bordado <[email protected]>
  • Loading branch information
timjrd and afonso360 authored Sep 5, 2023
1 parent 8eefa7c commit 36ca00c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cranelift/fuzzgen/src/function_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1375,9 +1375,9 @@ where
/// Generates an instruction(`iconst`/`fconst`/etc...) to introduce a constant value
fn generate_const(&mut self, builder: &mut FunctionBuilder, ty: Type) -> Result<Value> {
Ok(match self.u.datavalue(ty)? {
DataValue::I8(i) => builder.ins().iconst(ty, i as i64),
DataValue::I16(i) => builder.ins().iconst(ty, i as i64),
DataValue::I32(i) => builder.ins().iconst(ty, i as i64),
DataValue::I8(i) => builder.ins().iconst(ty, i as u8 as i64),
DataValue::I16(i) => builder.ins().iconst(ty, i as u16 as i64),
DataValue::I32(i) => builder.ins().iconst(ty, i as u32 as i64),
DataValue::I64(i) => builder.ins().iconst(ty, i as i64),
DataValue::I128(i) => {
let hi = builder.ins().iconst(I64, (i >> 64) as i64);
Expand Down

0 comments on commit 36ca00c

Please sign in to comment.