Skip to content

Commit b0ecbf1

Browse files
committed
Sign extend ints in trans_const_value
1 parent d9403bf commit b0ecbf1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/constant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ fn trans_const_value<'a, 'tcx: 'a>(
116116
}
117117
ty::Int(_) => {
118118
let bits = const_.val.try_to_bits(layout.size).unwrap();
119-
CValue::const_val(fx, ty, bits as i128 as i64)
119+
CValue::const_val(fx, ty, rustc::mir::interpret::sign_extend(bits, layout.size) as i128 as i64)
120120
}
121121
ty::FnDef(_def_id, _substs) => CValue::ByRef(
122122
fx.bcx

0 commit comments

Comments
 (0)