Skip to content

Commit 4dc4e9f

Browse files
tesujiAmanieu
andcommitted
Fix black_box bug detected by Amanieu
Co-authored-by: Amanieu <[email protected]>
1 parent 87666e5 commit 4dc4e9f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/core/src/hint.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ pub fn black_box<T>(mut dummy: T) -> T {
122122
// SAFETY: the inline assembly is a no-op.
123123
unsafe {
124124
// FIXME: Cannot use `asm!` because it doesn't support MIPS and other architectures.
125-
llvm_asm!("" : : "r"(&mut dummy));
125+
llvm_asm!("" : : "r"(&mut dummy) : "memory" : "volatile");
126126
}
127127

128128
dummy

0 commit comments

Comments
 (0)