@@ -59,6 +59,8 @@ impl<'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'mir, 'tcx> {
5959 // If intptrcast is enabled, treat everything of integer *type* at integer *value*.
6060 if self . memory ( ) . extra . rng . is_some ( ) && left. layout . ty . is_integral ( ) {
6161 // This is actually an integer operation, so dispatch back to the core engine.
62+ // TODO: Once intptrcast is the default, librustc_mir should never even call us
63+ // for integer types.
6264 assert ! ( right. layout. ty. is_integral( ) ) ;
6365 let l_bits = self . force_bits ( left. imm . to_scalar ( ) ?, left. layout . size ) ?;
6466 let r_bits = self . force_bits ( right. imm . to_scalar ( ) ?, right. layout . size ) ?;
@@ -186,6 +188,13 @@ impl<'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'mir, 'tcx> {
186188 right : Scalar < Tag > ,
187189 ) -> InterpResult < ' tcx , bool > {
188190 let size = self . pointer_size ( ) ;
191+ if self . memory ( ) . extra . rng . is_some ( ) {
192+ // Just compare the integers.
193+ // TODO: Do we really want to *always* do that, even when comparing two live in-bounds pointers?
194+ let left = self . force_bits ( left, size) ?;
195+ let right = self . force_bits ( right, size) ?;
196+ return Ok ( left == right) ;
197+ }
189198 Ok ( match ( left, right) {
190199 ( Scalar :: Raw { .. } , Scalar :: Raw { .. } ) =>
191200 left. to_bits ( size) ? == right. to_bits ( size) ?,
0 commit comments