Skip to content

Commit

Permalink
Fix black_box bug detected by Amanieu
Browse files Browse the repository at this point in the history
Co-authored-by: Amanieu <amanieu@gmail.com>
  • Loading branch information
tesuji and Amanieu committed Sep 16, 2020
1 parent 87666e5 commit 4dc4e9f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/core/src/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ pub fn black_box<T>(mut dummy: T) -> T {
// SAFETY: the inline assembly is a no-op.
unsafe {
// FIXME: Cannot use `asm!` because it doesn't support MIPS and other architectures.
llvm_asm!("" : : "r"(&mut dummy));
llvm_asm!("" : : "r"(&mut dummy) : "memory" : "volatile");
}

dummy
Expand Down

0 comments on commit 4dc4e9f

Please sign in to comment.