File tree 2 files changed +12
-1
lines changed
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -339,7 +339,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
339
339
) -> InterpResult < ' tcx , Scalar > {
340
340
let this = self . eval_context_mut ( ) ;
341
341
342
- let pipefd = this. deref_pointer ( pipefd) ?;
342
+ let pipefd = this. deref_pointer_as ( pipefd, this . machine . layouts . i32 ) ?;
343
343
let flags = match flags {
344
344
Some ( flags) => this. read_scalar ( flags) ?. to_i32 ( ) ?,
345
345
None => 0 ,
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ fn main() {
6
6
test_pipe ( ) ;
7
7
test_pipe_threaded ( ) ;
8
8
test_race ( ) ;
9
+ test_pipe_array ( ) ;
9
10
}
10
11
11
12
fn test_pipe ( ) {
@@ -97,3 +98,13 @@ fn test_race() {
97
98
thread:: yield_now ( ) ;
98
99
thread1. join ( ) . unwrap ( ) ;
99
100
}
101
+
102
+ fn test_pipe_array ( ) {
103
+ // Declare `pipe` to take an array rather than a `*mut i32`.
104
+ extern "C" {
105
+ fn pipe ( pipefd : & mut [ i32 ; 2 ] ) -> i32 ;
106
+ }
107
+
108
+ let mut fds: [ i32 ; 2 ] = [ 0 ; 2 ] ;
109
+ assert_eq ! ( unsafe { pipe( & mut fds) } , 0 ) ;
110
+ }
You can’t perform that action at this time.
0 commit comments