File tree Expand file tree Collapse file tree 3 files changed +19
-17
lines changed Expand file tree Collapse file tree 3 files changed +19
-17
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
27
27
. expect ( "This function should only be called in GenMC mode." ) ;
28
28
29
29
let get_mutex_call_infos = || {
30
- // assert!(!args.is_empty());
31
30
assert_eq ! ( args. len( ) , 1 ) ;
32
31
let arg = this. copy_fn_arg ( & args[ 0 ] ) ;
33
32
let addr = this. read_target_usize ( & arg) ?;
Original file line number Diff line number Diff line change 1
1
//@compile-flags: -Zmiri-genmc -Zmiri-disable-stacked-borrows
2
2
//@error-in-other-file: unsupported operation
3
3
4
- // TODO
4
+ // Test that we can detect a deadlock involving `std::sync::Mutex` in GenMC mode.
5
+ // FIXME(genmc): The error message for such deadlocks is currently not good, it does not show both involved lock call locations.
5
6
6
7
#![ no_main]
7
8
#![ feature( abort_unwind) ]
Original file line number Diff line number Diff line change @@ -54,21 +54,23 @@ fn main_() {
54
54
assert ! ( LOCK . try_lock( ) . is_ok( ) ) ; // Trying to lock now should *not* fail since the lock is not held.
55
55
}
56
56
57
- let ids = [
58
- spawn_pthread_closure ( || {
59
- for _ in 0 ..REPS {
60
- let mut guard = LOCK . lock ( ) . unwrap ( ) ;
61
- guard[ 0 ] += 2 ;
62
- }
63
- } ) ,
64
- spawn_pthread_closure ( || {
65
- for _ in 0 ..REPS {
66
- let mut guard = LOCK . lock ( ) . unwrap ( ) ;
67
- guard[ 0 ] += 4 ;
68
- }
69
- } ) ,
70
- ] ;
71
- unsafe { join_pthreads ( ids) } ;
57
+ unsafe {
58
+ let ids = [
59
+ spawn_pthread_closure ( || {
60
+ for _ in 0 ..REPS {
61
+ let mut guard = LOCK . lock ( ) . unwrap ( ) ;
62
+ guard[ 0 ] += 2 ;
63
+ }
64
+ } ) ,
65
+ spawn_pthread_closure ( || {
66
+ for _ in 0 ..REPS {
67
+ let mut guard = LOCK . lock ( ) . unwrap ( ) ;
68
+ guard[ 0 ] += 4 ;
69
+ }
70
+ } ) ,
71
+ ] ;
72
+ join_pthreads ( ids) ;
73
+ }
72
74
73
75
let guard = LOCK . lock ( ) . unwrap ( ) ;
74
76
assert ! ( guard[ 0 ] == REPS * 6 ) ; // Due to locking, all increments should be visible in every execution.
You can’t perform that action at this time.
0 commit comments