Handle StorageLive

This commit is contained in:
Jannis Christopher Köhl 2022-09-09 11:56:10 +02:00
parent e2ddf8a6e5
commit 817c27744d

View File

@ -83,20 +83,21 @@ fn super_statement(&self, statement: &Statement<'tcx>, state: &mut State<Self::V
}
StatementKind::SetDiscriminant { .. } => {
// Could treat this as writing a constant to a pseudo-place.
// But discriminants are currently not tracked, so we do nothing.
// Related: https://github.com/rust-lang/unsafe-code-guidelines/issues/84
}
StatementKind::CopyNonOverlapping(..) => {
// FIXME: What to do here?
}
StatementKind::StorageDead(local) => {
// It is UB to access an unallocated local.
StatementKind::StorageLive(local) | StatementKind::StorageDead(local) => {
// It is UB to read from an unitialized or unallocated local.
state.flood(Place::from(*local).as_ref(), self.map());
}
StatementKind::Deinit(box place) => {
// It is UB to access `uninit` bytes.
// It is UB to read `uninit` bytes.
state.flood(place.as_ref(), self.map());
}
StatementKind::Nop
| StatementKind::StorageLive(..)
| StatementKind::Retag(..)
| StatementKind::FakeRead(..)
| StatementKind::Coverage(..)