Skip to content

Commit 457c823

Browse files
committed
only treat integer operations as such
1 parent 44298d8 commit 457c823

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/operator.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ impl<'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'mir, 'tcx> {
5656

5757
trace!("ptr_op: {:?} {:?} {:?}", *left, bin_op, *right);
5858

59-
// If intptrcast is enabled and the operation is not an offset
60-
// we can force the cast from pointers to integer addresses and
61-
// then dispatch to rustc binary operation method
62-
if self.memory().extra.rng.is_some() && bin_op != Offset {
59+
// If intptrcast is enabled, treat everything of integer *type* at integer *value*.
60+
if self.memory().extra.rng.is_some() && left.layout.ty.is_integral() {
61+
// This is actually an integer operation, so dispatch back to the core engine.
62+
assert!(right.layout.ty.is_integral());
6363
let l_bits = self.force_bits(left.imm.to_scalar()?, left.layout.size)?;
6464
let r_bits = self.force_bits(right.imm.to_scalar()?, right.layout.size)?;
6565

0 commit comments

Comments
 (0)