Skip to content

Commit

Permalink
Fix backwards cmpxchg_weak_failure_rate check
Browse files Browse the repository at this point in the history
  • Loading branch information
thomcc committed May 23, 2022
1 parent 62ea0c8 commit 7bbaada
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/data_race.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
// of the time, based on `rate`.
let rate = this.machine.cmpxchg_weak_failure_rate;
let cmpxchg_success = eq.to_scalar()?.to_bool()?
&& (!can_fail_spuriously || this.machine.rng.get_mut().gen::<f64>() < rate);
&& (!can_fail_spuriously || this.machine.rng.get_mut().gen_bool(rate));
let res = Immediate::ScalarPair(
old.to_scalar_or_uninit(),
Scalar::from_bool(cmpxchg_success).into(),
Expand Down

0 comments on commit 7bbaada

Please sign in to comment.