File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 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> {
339339 ) -> InterpResult < ' tcx , Scalar > {
340340 let this = self . eval_context_mut ( ) ;
341341
342- let pipefd = this. deref_pointer ( pipefd) ?;
342+ let pipefd = this. deref_pointer_as ( pipefd, this . machine . layouts . i32 ) ?;
343343 let flags = match flags {
344344 Some ( flags) => this. read_scalar ( flags) ?. to_i32 ( ) ?,
345345 None => 0 ,
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ fn main() {
66 test_pipe ( ) ;
77 test_pipe_threaded ( ) ;
88 test_race ( ) ;
9+ test_pipe_array ( ) ;
910}
1011
1112fn test_pipe ( ) {
@@ -97,3 +98,13 @@ fn test_race() {
9798 thread:: yield_now ( ) ;
9899 thread1. join ( ) . unwrap ( ) ;
99100}
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