From 23b4af84884261fec154b291265eb0ea2143b2bc Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Thu, 16 Nov 2023 17:06:11 -0500 Subject: [PATCH] Check provenance mode first --- src/intptrcast.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/intptrcast.rs b/src/intptrcast.rs index d3c0352484..a66d9ab95f 100644 --- a/src/intptrcast.rs +++ b/src/intptrcast.rs @@ -197,17 +197,19 @@ impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriInterpCx<'mir, pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { fn expose_ptr(&mut self, alloc_id: AllocId, tag: BorTag) -> InterpResult<'tcx> { let ecx = self.eval_context_mut(); - // Exposing a dead alloc is a no-op, because it's not possible to get a dead allocation - // via int2ptr. - if matches!(ecx.get_alloc_info(alloc_id).2, AllocKind::Dead) { - return Ok(()); - } let global_state = ecx.machine.intptrcast.get_mut(); // In strict mode, we don't need this, so we can save some cycles by not tracking it. if global_state.provenance_mode == ProvenanceMode::Strict { return Ok(()); } + // Exposing a dead alloc is a no-op, because it's not possible to get a dead allocation + // via int2ptr. + if matches!(ecx.get_alloc_info(alloc_id).2, AllocKind::Dead) { + return Ok(()); + } trace!("Exposing allocation id {alloc_id:?}"); + let ecx = self.eval_context_mut(); + let global_state = ecx.machine.intptrcast.get_mut(); global_state.exposed.insert(alloc_id); if ecx.machine.borrow_tracker.is_some() { ecx.expose_tag(alloc_id, tag)?;