diff --git a/src/shims/foreign_items/posix.rs b/src/shims/foreign_items/posix.rs index 39b00feec194..09191011a4a8 100644 --- a/src/shims/foreign_items/posix.rs +++ b/src/shims/foreign_items/posix.rs @@ -170,7 +170,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx // Dynamic symbol loading "dlsym" => { let &[handle, symbol] = check_arg_count(args)?; - this.read_scalar(handle)?.not_undef()?; + this.read_scalar(handle)?.to_machine_usize(this)?; let symbol = this.read_scalar(symbol)?.not_undef()?; let symbol_name = this.memory.read_c_str(symbol)?; if let Some(dlsym) = Dlsym::from_str(symbol_name, &this.tcx.sess.target.target.target_os)? { @@ -369,9 +369,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx } "pthread_atfork" => { let &[prepare, parent, child] = check_arg_count(args)?; - this.read_scalar(prepare)?.not_undef()?; - this.read_scalar(parent)?.not_undef()?; - this.read_scalar(child)?.not_undef()?; + this.force_bits(this.read_scalar(prepare)?.not_undef()?, this.memory.pointer_size())?; + this.force_bits(this.read_scalar(parent)?.not_undef()?, this.memory.pointer_size())?; + this.force_bits(this.read_scalar(child)?.not_undef()?, this.memory.pointer_size())?; // We do not support forking, so there is nothing to do here. this.write_null(dest)?; } diff --git a/src/shims/foreign_items/posix/macos.rs b/src/shims/foreign_items/posix/macos.rs index 1cfecbc93461..e6d39af45395 100644 --- a/src/shims/foreign_items/posix/macos.rs +++ b/src/shims/foreign_items/posix/macos.rs @@ -105,13 +105,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx // Querying system information "pthread_get_stackaddr_np" => { let &[thread] = check_arg_count(args)?; - this.read_scalar(thread)?.not_undef()?; + this.read_scalar(thread)?.to_machine_usize(this)?; let stack_addr = Scalar::from_uint(STACK_ADDR, this.pointer_size()); this.write_scalar(stack_addr, dest)?; } "pthread_get_stacksize_np" => { let &[thread] = check_arg_count(args)?; - this.read_scalar(thread)?.not_undef()?; + this.read_scalar(thread)?.to_machine_usize(this)?; let stack_size = Scalar::from_uint(STACK_SIZE, this.pointer_size()); this.write_scalar(stack_size, dest)?; } diff --git a/src/shims/foreign_items/windows.rs b/src/shims/foreign_items/windows.rs index 60448406a67d..c24824153ca2 100644 --- a/src/shims/foreign_items/windows.rs +++ b/src/shims/foreign_items/windows.rs @@ -210,7 +210,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx "GetProcAddress" => { #[allow(non_snake_case)] let &[hModule, lpProcName] = check_arg_count(args)?; - this.read_scalar(hModule)?.not_undef()?; + this.read_scalar(hModule)?.to_machine_isize(this)?; let name = this.memory.read_c_str(this.read_scalar(lpProcName)?.not_undef()?)?; if let Some(dlsym) = Dlsym::from_str(name, &this.tcx.sess.target.target.target_os)? { let ptr = this.memory.create_fn_alloc(FnVal::Other(dlsym));