From 4dc4e9f671a36026cf59894622fdf4f6b979bf76 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Wed, 16 Sep 2020 09:25:54 +0000 Subject: [PATCH] Fix black_box bug detected by Amanieu Co-authored-by: Amanieu --- library/core/src/hint.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/hint.rs b/library/core/src/hint.rs index 929c22e4538f..1192b9e164a1 100644 --- a/library/core/src/hint.rs +++ b/library/core/src/hint.rs @@ -122,7 +122,7 @@ pub fn black_box(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