Use StorageDead and Deinit to flood place

This commit is contained in:
Jannis Christopher Köhl 2022-09-04 12:29:19 +02:00
parent 904adcac0f
commit 1e5ca57014

View File

@ -87,12 +87,16 @@ pub trait ValueAnalysis<'tcx> {
StatementKind::CopyNonOverlapping(..) => {
// FIXME: What to do here?
}
StatementKind::StorageLive(..)
| StatementKind::StorageDead(..)
| StatementKind::Deinit(_) => {
// Could perhaps use these.
StatementKind::StorageDead(local) => {
// It is UB to access an unallocated local.
state.flood(Place::from(*local).as_ref(), self.map());
}
StatementKind::Deinit(box place) => {
// It is UB to access `uninit` bytes.
state.flood(place.as_ref(), self.map());
}
StatementKind::Nop
| StatementKind::StorageLive(..)
| StatementKind::Retag(..)
| StatementKind::FakeRead(..)
| StatementKind::Coverage(..)