@@ -489,7 +489,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
489
489
type AllocExtra = AllocExtra ;
490
490
491
491
type PointerTag = Tag ;
492
- type TagExtra = SbTag ;
492
+ type TagExtra = Option < SbTag > ;
493
493
494
494
type MemoryMap =
495
495
MonoHashMap < AllocId , ( MemoryKind < MiriMemoryKind > , Allocation < Tag , Self :: AllocExtra > ) > ;
@@ -695,8 +695,24 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
695
695
ptr : Pointer < Self :: PointerTag > ,
696
696
) -> InterpResult < ' tcx > {
697
697
match ptr. provenance {
698
- Tag :: Concrete ( concrete) =>
699
- intptrcast:: GlobalStateInner :: expose_addr ( ecx, concrete. alloc_id ) ,
698
+ Tag :: Concrete ( ConcreteTag { alloc_id, sb } ) => {
699
+ intptrcast:: GlobalStateInner :: expose_addr ( ecx, alloc_id) ;
700
+
701
+ let ( size, _) =
702
+ ecx. get_alloc_size_and_align ( alloc_id, AllocCheck :: MaybeDead ) . unwrap ( ) ;
703
+
704
+ // Function pointers and dead objects don't have an alloc_extra so we ignore them.
705
+ if let Ok ( alloc_extra) = ecx. get_alloc_extra ( alloc_id) {
706
+ if let Some ( stacked_borrows) = & alloc_extra. stacked_borrows {
707
+ stacked_borrows. ptr_exposed (
708
+ alloc_id,
709
+ sb,
710
+ alloc_range ( Size :: from_bytes ( 0 ) , size) ,
711
+ ecx. machine . stacked_borrows . as_ref ( ) . unwrap ( ) ,
712
+ ) ?;
713
+ }
714
+ }
715
+ }
700
716
Tag :: Wildcard => {
701
717
// No need to do anything for wildcard pointers as
702
718
// their provenances have already been previously exposed.
@@ -715,8 +731,8 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
715
731
716
732
rel. map ( |( alloc_id, size) | {
717
733
let sb = match ptr. provenance {
718
- Tag :: Concrete ( ConcreteTag { sb, .. } ) => sb ,
719
- Tag :: Wildcard => SbTag :: Untagged ,
734
+ Tag :: Concrete ( ConcreteTag { sb, .. } ) => Some ( sb ) ,
735
+ Tag :: Wildcard => None ,
720
736
} ;
721
737
( alloc_id, size, sb)
722
738
} )
0 commit comments