@@ -170,7 +170,7 @@ fn mutex_create<'tcx>(
170
170
mutex_ptr : & OpTy < ' tcx > ,
171
171
kind : MutexKind ,
172
172
) -> 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" ) ) ?;
174
174
let id = ecx. machine . sync . mutex_create ( ) ;
175
175
let data = PthreadMutex { mutex_ref : id, kind } ;
176
176
ecx. lazy_sync_init ( & mutex, mutex_init_offset ( ecx) ?, data. clone ( ) ) ?;
@@ -186,7 +186,7 @@ fn mutex_get_data<'tcx, 'a>(
186
186
where
187
187
' tcx : ' a ,
188
188
{
189
- let mutex = ecx. deref_pointer ( mutex_ptr) ?;
189
+ let mutex = ecx. deref_pointer_as ( mutex_ptr, ecx . libc_ty_layout ( "pthread_mutex_t" ) ) ?;
190
190
ecx. lazy_sync_get_data (
191
191
& mutex,
192
192
mutex_init_offset ( ecx) ?,
@@ -265,7 +265,7 @@ fn rwlock_get_data<'tcx, 'a>(
265
265
where
266
266
' tcx : ' a ,
267
267
{
268
- let rwlock = ecx. deref_pointer ( rwlock_ptr) ?;
268
+ let rwlock = ecx. deref_pointer_as ( rwlock_ptr, ecx . libc_ty_layout ( "pthread_rwlock_t" ) ) ?;
269
269
ecx. lazy_sync_get_data (
270
270
& rwlock,
271
271
rwlock_init_offset ( ecx) ?,
@@ -383,7 +383,7 @@ fn cond_create<'tcx>(
383
383
cond_ptr : & OpTy < ' tcx > ,
384
384
clock : ClockId ,
385
385
) -> 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" ) ) ?;
387
387
let id = ecx. machine . sync . condvar_create ( ) ;
388
388
let data = PthreadCondvar { id, clock } ;
389
389
ecx. lazy_sync_init ( & cond, cond_init_offset ( ecx) ?, data) ?;
@@ -397,7 +397,7 @@ fn cond_get_data<'tcx, 'a>(
397
397
where
398
398
' tcx : ' a ,
399
399
{
400
- let cond = ecx. deref_pointer ( cond_ptr) ?;
400
+ let cond = ecx. deref_pointer_as ( cond_ptr, ecx . libc_ty_layout ( "pthread_cond_t" ) ) ?;
401
401
ecx. lazy_sync_get_data (
402
402
& cond,
403
403
cond_init_offset ( ecx) ?,
@@ -760,7 +760,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
760
760
let this = self . eval_context_mut ( ) ;
761
761
762
762
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
+ ) ?;
764
767
765
768
interp_ok ( ( ) )
766
769
}
0 commit comments