Skip to content

Commit 23b4af8

Browse files
committed
Check provenance mode first
1 parent 68ec121 commit 23b4af8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/intptrcast.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -197,17 +197,19 @@ impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriInterpCx<'mir,
197197
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
198198
fn expose_ptr(&mut self, alloc_id: AllocId, tag: BorTag) -> InterpResult<'tcx> {
199199
let ecx = self.eval_context_mut();
200-
// Exposing a dead alloc is a no-op, because it's not possible to get a dead allocation
201-
// via int2ptr.
202-
if matches!(ecx.get_alloc_info(alloc_id).2, AllocKind::Dead) {
203-
return Ok(());
204-
}
205200
let global_state = ecx.machine.intptrcast.get_mut();
206201
// In strict mode, we don't need this, so we can save some cycles by not tracking it.
207202
if global_state.provenance_mode == ProvenanceMode::Strict {
208203
return Ok(());
209204
}
205+
// Exposing a dead alloc is a no-op, because it's not possible to get a dead allocation
206+
// via int2ptr.
207+
if matches!(ecx.get_alloc_info(alloc_id).2, AllocKind::Dead) {
208+
return Ok(());
209+
}
210210
trace!("Exposing allocation id {alloc_id:?}");
211+
let ecx = self.eval_context_mut();
212+
let global_state = ecx.machine.intptrcast.get_mut();
211213
global_state.exposed.insert(alloc_id);
212214
if ecx.machine.borrow_tracker.is_some() {
213215
ecx.expose_tag(alloc_id, tag)?;

0 commit comments

Comments
 (0)