From b0ecbf14a23a301183ff194ca97a62e23e2cc6f7 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Mon, 11 Mar 2019 20:44:05 +0100 Subject: [PATCH] Sign extend ints in trans_const_value --- src/constant.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constant.rs b/src/constant.rs index 14e7585b812e..01c8f84125a2 100644 --- a/src/constant.rs +++ b/src/constant.rs @@ -116,7 +116,7 @@ fn trans_const_value<'a, 'tcx: 'a>( } ty::Int(_) => { let bits = const_.val.try_to_bits(layout.size).unwrap(); - CValue::const_val(fx, ty, bits as i128 as i64) + CValue::const_val(fx, ty, rustc::mir::interpret::sign_extend(bits, layout.size) as i128 as i64) } ty::FnDef(_def_id, _substs) => CValue::ByRef( fx.bcx