From 74b17685fe6d73189dcaf105bc2f4405f6719e7b Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Tue, 10 Aug 2021 11:50:33 +0100 Subject: [PATCH] Implement `black_box` using intrinsic The new implementation allows some `memcpy`s to be optimized away, so the uninit value in ui/sanitize/memory.rs is constructed directly onto the return place. Therefore the sanitizer now says that the value is allocated by `main` rather than `random`. --- src/intrinsics/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/intrinsics/mod.rs b/src/intrinsics/mod.rs index 86698460747..1c4d307fc50 100644 --- a/src/intrinsics/mod.rs +++ b/src/intrinsics/mod.rs @@ -1136,6 +1136,11 @@ fn type_by_size(size: Size) -> Option { }; ret.write_cvalue(fx, CValue::by_val(is_eq_value, ret.layout())); }; + + black_box, (c a) { + // FIXME implement black_box semantics + ret.write_cvalue(fx, a); + }; } if let Some((_, dest)) = destination {