1 // needs-sanitizer-support
2 // needs-sanitizer-memory
4 // revisions: unoptimized optimized
6 // [optimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins -O
7 // [unoptimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins
11 // This test case intentionally limits the usage of the std,
12 // since it will be linked with an uninstrumented version of it.
14 #![feature(core_intrinsics)]
16 #![allow(invalid_value)]
18 use std::hint::black_box;
20 fn calling_black_box_on_zst_ok() {
21 // It's OK to call black_box on a value of a zero-sized type, even if its
22 // underlying the memory location is uninitialized. For non-zero-sized types,
23 // this would be an MSAN error.
29 fn main(_: isize, _: *const *const u8) -> isize {
30 calling_black_box_on_zst_ok();