SB wildcard handling: extend comments

This commit is contained in:
Ralf Jung 2025-10-23 08:56:00 +02:00
parent 86bb8ebacb
commit ce35d4ca81

View file

@ -675,16 +675,22 @@ trait EvalContextPrivExt<'tcx, 'ecx>: crate::MiriInterpCxExt<'tcx> {
if let Ok((alloc_id, base_offset, orig_tag)) = this.ptr_try_get_alloc_id(place.ptr(), 0)
{
log_creation(this, Some((alloc_id, base_offset, orig_tag)))?;
// Still give it the new provenance, it got retagged after all.
// Still give it the new provenance, it got retagged after all. If this was a
// wildcard pointer, this will fix the AllocId and make future accesses with this
// reference to other allocations UB, but that's fine: due to subobject provenance,
// *all* future accesses with this reference should be UB!
return interp_ok(Some(Provenance::Concrete { alloc_id, tag: new_tag }));
} else {
// This pointer doesn't come with an AllocId. :shrug:
log_creation(this, None)?;
// Provenance unchanged.
// Provenance unchanged. Ideally we'd make this pointer UB to use like above,
// but there's no easy way to do that.
return interp_ok(place.ptr().provenance);
}
}
// The pointer *must* have a valid AllocId to continue, so we want to resolve this to
// a concrete ID even for wildcard pointers.
let (alloc_id, base_offset, orig_tag) = this.ptr_get_alloc_id(place.ptr(), 0)?;
log_creation(this, Some((alloc_id, base_offset, orig_tag)))?;