1 // needs-sanitizer-support
2 // needs-sanitizer-memory
3 // min-llvm-version: 14.0.0
5 // revisions: unoptimized optimized
7 // [optimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins -O
8 // [unoptimized]compile-flags: -Z sanitizer=memory -Zsanitizer-memory-track-origins
11 // error-pattern: MemorySanitizer: use-of-uninitialized-value
12 // error-pattern: Uninitialized value was created by an allocation
13 // error-pattern: in the stack frame
15 // This test case intentionally limits the usage of the std,
16 // since it will be linked with an uninstrumented version of it.
18 #![feature(core_intrinsics)]
21 use std::hint::black_box;
22 use std::mem::MaybeUninit;
26 #[allow(invalid_value)]
28 let r = unsafe { MaybeUninit::uninit().assume_init() };
29 // Avoid optimizing everything out.
34 fn main(_: isize, _: *const *const u8) -> isize {