提交 a589ccb8 编写于 作者: O Oliver Schneider 提交者: GitHub

Merge pull request #225 from RalfJung/comments

cast -> transmute
......@@ -1347,7 +1347,7 @@ fn try_read_value(&mut self, ptr: Pointer, ty: Ty<'tcx>) -> EvalResult<'tcx, Opt
I128 => 16,
Is => self.memory.pointer_size(),
};
// if we cast a ptr to an isize, reading it back into a primval shouldn't panic
// if we transmute a ptr to an isize, reading it back into a primval shouldn't panic
// Due to read_ptr ignoring the sign, we need to jump around some hoops
match self.memory.read_int(ptr, size) {
Err(EvalError::ReadPointerAsBytes) if size == self.memory.pointer_size() => self.memory.read_ptr(ptr)?,
......@@ -1366,7 +1366,7 @@ fn try_read_value(&mut self, ptr: Pointer, ty: Ty<'tcx>) -> EvalResult<'tcx, Opt
Us => self.memory.pointer_size(),
};
if size == self.memory.pointer_size() {
// if we cast a ptr to an usize, reading it back into a primval shouldn't panic
// if we transmute a ptr to an usize, reading it back into a primval shouldn't panic
self.memory.read_ptr(ptr)?
} else {
PrimVal::from_u128(self.memory.read_uint(ptr, size)?)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册