diff options
| author | Lzu Tao <taolzu@gmail.com> | 2020-09-16 09:25:54 +0000 |
|---|---|---|
| committer | Lzu Tao <taolzu@gmail.com> | 2020-09-16 09:25:54 +0000 |
| commit | 4dc4e9f671a36026cf59894622fdf4f6b979bf76 (patch) | |
| tree | 64ab520f69eea81a4f88f8364c66b719830176ed | |
| parent | 87666e5bce23c8ef420dfb0e5d86668ddf1acbf2 (diff) | |
| download | rust-4dc4e9f671a36026cf59894622fdf4f6b979bf76.tar.gz rust-4dc4e9f671a36026cf59894622fdf4f6b979bf76.zip | |
Fix black_box bug detected by Amanieu
Co-authored-by: Amanieu <amanieu@gmail.com>
| -rw-r--r-- | library/core/src/hint.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/core/src/hint.rs b/library/core/src/hint.rs index 929c22e4538..1192b9e164a 100644 --- a/library/core/src/hint.rs +++ b/library/core/src/hint.rs @@ -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 |
