Skip to content

Commit

Permalink
Handle spurious failures caused by delayed UB instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
artemagvanian committed Jul 30, 2024
1 parent 5fe54f2 commit 076f5ad
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use rustc_middle::ty::TyCtxt;
use rustc_smir::rustc_internal;
use stable_mir::mir::{
visit::{Location, PlaceContext},
BasicBlockIdx, MirVisitor, Operand, Place, Statement, Terminator,
BasicBlockIdx, MirVisitor, Operand, Place, Rvalue, Statement, Terminator,
};
use std::collections::HashSet;

Expand Down Expand Up @@ -103,6 +103,15 @@ impl<'a, 'tcx> MirVisitor for InstrumentationVisitor<'a, 'tcx> {
}
}

fn visit_rvalue(&mut self, rvalue: &Rvalue, location: Location) {
match rvalue {
Rvalue::AddressOf(..) | Rvalue::Ref(..) => {
// These operations are always legitimate for us.
}
_ => self.super_rvalue(rvalue, location),
}
}

fn visit_place(&mut self, place: &Place, ptx: PlaceContext, location: Location) {
// Match the place by whatever it is pointing to and find an intersection with the targets.
if self
Expand Down

0 comments on commit 076f5ad

Please sign in to comment.