Skip to content

Commit 74b1768

Browse files
committed
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`.
1 parent d220159 commit 74b1768

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/intrinsics/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,11 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
11361136
};
11371137
ret.write_cvalue(fx, CValue::by_val(is_eq_value, ret.layout()));
11381138
};
1139+
1140+
black_box, (c a) {
1141+
// FIXME implement black_box semantics
1142+
ret.write_cvalue(fx, a);
1143+
};
11391144
}
11401145

11411146
if let Some((_, dest)) = destination {

0 commit comments

Comments
 (0)