Mark bytes undefined in uninit intrinsic.

This commit is contained in:
Scott Olson 2016-03-28 16:37:07 -06:00
parent 56e118f86c
commit 62294d0c42
2 changed files with 6 additions and 3 deletions

View File

@ -439,8 +439,9 @@ impl<'a, 'tcx: 'a, 'arena> Interpreter<'a, 'tcx, 'arena> {
try!(self.memory.copy(src, dest, dest_size));
}
// TODO(tsion): Mark bytes as undef.
"uninit" => {}
"uninit" => {
try!(self.memory.mark_definedness(dest, dest_size, false));
}
name => panic!("can't handle intrinsic: {}", name),
}

View File

@ -348,7 +348,9 @@ impl Memory {
Ok(())
}
fn mark_definedness(&mut self, ptr: Pointer, size: usize, new_state: bool) -> EvalResult<()> {
pub fn mark_definedness(&mut self, ptr: Pointer, size: usize, new_state: bool)
-> EvalResult<()>
{
let mut alloc = try!(self.get_mut(ptr.alloc_id));
alloc.mark_definedness(ptr.offset, ptr.offset + size, new_state);
Ok(())