From 36ca00c0a830ae6394cf188f9c02d1d5076ceb2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Jourde?= Date: Wed, 6 Sep 2023 00:39:02 +0200 Subject: [PATCH] cranelift: Fix fuzzgen `iconst` encoding (#6967) Resolves #6965 Linked to #3059 #6850 #6958 Co-authored-by: Afonso Bordado --- cranelift/fuzzgen/src/function_generator.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cranelift/fuzzgen/src/function_generator.rs b/cranelift/fuzzgen/src/function_generator.rs index b2ce4e1ee189..4ef64320526a 100644 --- a/cranelift/fuzzgen/src/function_generator.rs +++ b/cranelift/fuzzgen/src/function_generator.rs @@ -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 { 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);