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