From 457c8237652e123010555b5ecc795a5a4fd6111f Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 3 Jul 2019 09:06:48 +0200 Subject: [PATCH] only treat integer operations as such --- src/operator.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/operator.rs b/src/operator.rs index d3af1f0db0e..31def2fec0e 100644 --- a/src/operator.rs +++ b/src/operator.rs @@ -56,10 +56,10 @@ fn ptr_op( trace!("ptr_op: {:?} {:?} {:?}", *left, bin_op, *right); - // If intptrcast is enabled and the operation is not an offset - // we can force the cast from pointers to integer addresses and - // then dispatch to rustc binary operation method - if self.memory().extra.rng.is_some() && bin_op != Offset { + // If intptrcast is enabled, treat everything of integer *type* at integer *value*. + if self.memory().extra.rng.is_some() && left.layout.ty.is_integral() { + // This is actually an integer operation, so dispatch back to the core engine. + assert!(right.layout.ty.is_integral()); let l_bits = self.force_bits(left.imm.to_scalar()?, left.layout.size)?; let r_bits = self.force_bits(right.imm.to_scalar()?, right.layout.size)?; -- 2.44.0