about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>2017-08-08 17:02:01 +0200
committerOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>2017-08-08 17:09:26 +0200
commitbba753deac0d34081c8a66d70be3e45ed563dc03 (patch)
tree57268286e62f71e04863cda27e2df2f9faab6bf6
parent9e787fbd82050ab2f15cc9897acd1cf42d5fc8aa (diff)
downloadrust-bba753deac0d34081c8a66d70be3e45ed563dc03.tar.gz
rust-bba753deac0d34081c8a66d70be3e45ed563dc03.zip
c_int != usize
-rw-r--r--miri/fn_call.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/miri/fn_call.rs b/miri/fn_call.rs
index 2ffd10b9d0a..8b07b577bdd 100644
--- a/miri/fn_call.rs
+++ b/miri/fn_call.rs
@@ -317,7 +317,8 @@ impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator>
             }
 
             "sysconf" => {
-                let name = self.value_to_primval(args[0], usize)?.to_u64()?;
+                let c_int = self.operand_ty(&arg_operands[0]);
+                let name = self.value_to_primval(args[0], c_int)?.to_u64()?;
                 trace!("sysconf() called with name {}", name);
                 // cache the sysconf integers via miri's global cache
                 let paths = &[
@@ -330,7 +331,7 @@ impl<'a, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'tcx, super::Evaluator>
                         let cid = GlobalId { instance, promoted: None };
                         // compute global if not cached
                         let val = match self.globals.get(&cid).cloned() {
-                            Some(ptr) => self.value_to_primval(Value::ByRef(ptr), usize)?.to_u64()?,
+                            Some(ptr) => self.value_to_primval(Value::ByRef(ptr), c_int)?.to_u64()?,
                             None => eval_body_as_primval(self.tcx, instance)?.0.to_u64()?,
                         };
                         if val == name {