@@ -51,7 +51,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
51
51
fn pthread_detach ( & mut self , thread : & OpTy < ' tcx , Provenance > ) -> InterpResult < ' tcx , i32 > {
52
52
let this = self . eval_context_mut ( ) ;
53
53
54
- let thread_id = this. read_target_usize ( thread) ?;
54
+ let thread_id = this. read_scalar ( thread) ? . to_int ( this . libc_ty_layout ( "pthread_t" ) . size ) ?;
55
55
this. detach_thread (
56
56
thread_id. try_into ( ) . expect ( "thread ID should fit in u32" ) ,
57
57
/*allow_terminated_joined*/ false ,
@@ -64,7 +64,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
64
64
let this = self . eval_context_mut ( ) ;
65
65
66
66
let thread_id = this. get_active_thread ( ) ;
67
- Ok ( Scalar :: from_target_usize ( thread_id. into ( ) , this) )
67
+ Ok ( Scalar :: from_uint ( thread_id. to_u32 ( ) , this. libc_ty_layout ( "pthread_t" ) . size ) )
68
68
}
69
69
70
70
/// Set the name of the current thread. `max_name_len` is the maximal length of the name
@@ -77,7 +77,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
77
77
) -> InterpResult < ' tcx , Scalar < Provenance > > {
78
78
let this = self . eval_context_mut ( ) ;
79
79
80
- let thread = ThreadId :: try_from ( thread. to_target_usize ( this) ?) . unwrap ( ) ;
80
+ let thread = thread. to_int ( this. libc_ty_layout ( "pthread_t" ) . size ) ?;
81
+ let thread = ThreadId :: try_from ( thread) . unwrap ( ) ;
81
82
let name = name. to_pointer ( this) ?;
82
83
83
84
let name = this. read_c_str ( name) ?. to_owned ( ) ;
@@ -100,7 +101,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
100
101
) -> InterpResult < ' tcx , Scalar < Provenance > > {
101
102
let this = self . eval_context_mut ( ) ;
102
103
103
- let thread = ThreadId :: try_from ( thread. to_target_usize ( this) ?) . unwrap ( ) ;
104
+ let thread = thread. to_int ( this. libc_ty_layout ( "pthread_t" ) . size ) ?;
105
+ let thread = ThreadId :: try_from ( thread) . unwrap ( ) ;
104
106
let name_out = name_out. to_pointer ( this) ?;
105
107
let len = len. to_target_usize ( this) ?;
106
108
0 commit comments