@@ -170,7 +170,7 @@ fn mutex_create<'tcx>(
170170 mutex_ptr : & OpTy < ' tcx > ,
171171 kind : MutexKind ,
172172) -> InterpResult < ' tcx , PthreadMutex > {
173- let mutex = ecx. deref_pointer ( mutex_ptr) ?;
173+ let mutex = ecx. deref_pointer_as ( mutex_ptr, ecx . libc_ty_layout ( "pthread_mutex_t" ) ) ?;
174174 let id = ecx. machine . sync . mutex_create ( ) ;
175175 let data = PthreadMutex { mutex_ref : id, kind } ;
176176 ecx. lazy_sync_init ( & mutex, mutex_init_offset ( ecx) ?, data. clone ( ) ) ?;
@@ -186,7 +186,7 @@ fn mutex_get_data<'tcx, 'a>(
186186where
187187 ' tcx : ' a ,
188188{
189- let mutex = ecx. deref_pointer ( mutex_ptr) ?;
189+ let mutex = ecx. deref_pointer_as ( mutex_ptr, ecx . libc_ty_layout ( "pthread_mutex_t" ) ) ?;
190190 ecx. lazy_sync_get_data (
191191 & mutex,
192192 mutex_init_offset ( ecx) ?,
@@ -265,7 +265,7 @@ fn rwlock_get_data<'tcx, 'a>(
265265where
266266 ' tcx : ' a ,
267267{
268- let rwlock = ecx. deref_pointer ( rwlock_ptr) ?;
268+ let rwlock = ecx. deref_pointer_as ( rwlock_ptr, ecx . libc_ty_layout ( "pthread_rwlock_t" ) ) ?;
269269 ecx. lazy_sync_get_data (
270270 & rwlock,
271271 rwlock_init_offset ( ecx) ?,
@@ -383,7 +383,7 @@ fn cond_create<'tcx>(
383383 cond_ptr : & OpTy < ' tcx > ,
384384 clock : ClockId ,
385385) -> InterpResult < ' tcx , PthreadCondvar > {
386- let cond = ecx. deref_pointer ( cond_ptr) ?;
386+ let cond = ecx. deref_pointer_as ( cond_ptr, ecx . libc_ty_layout ( "pthread_cond_t" ) ) ?;
387387 let id = ecx. machine . sync . condvar_create ( ) ;
388388 let data = PthreadCondvar { id, clock } ;
389389 ecx. lazy_sync_init ( & cond, cond_init_offset ( ecx) ?, data) ?;
@@ -397,7 +397,7 @@ fn cond_get_data<'tcx, 'a>(
397397where
398398 ' tcx : ' a ,
399399{
400- let cond = ecx. deref_pointer ( cond_ptr) ?;
400+ let cond = ecx. deref_pointer_as ( cond_ptr, ecx . libc_ty_layout ( "pthread_cond_t" ) ) ?;
401401 ecx. lazy_sync_get_data (
402402 & cond,
403403 cond_init_offset ( ecx) ?,
@@ -760,7 +760,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
760760 let this = self . eval_context_mut ( ) ;
761761
762762 let clock_id = condattr_get_clock_id ( this, attr_op) ?;
763- this. write_scalar ( Scalar :: from_i32 ( clock_id) , & this. deref_pointer ( clk_id_op) ?) ?;
763+ this. write_scalar (
764+ Scalar :: from_i32 ( clock_id) ,
765+ & this. deref_pointer_as ( clk_id_op, this. libc_ty_layout ( "clockid_t" ) ) ?,
766+ ) ?;
764767
765768 interp_ok ( ( ) )
766769 }
0 commit comments