Fix black_box bug detected by Amanieu

Co-authored-by: Amanieu <amanieu@gmail.com>
This commit is contained in:
Lzu Tao 2020-09-16 09:25:54 +00:00
parent 87666e5bce
commit 4dc4e9f671

View file

@ -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