]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/sanitizer-memory-track-orgins.rs
Do not use Cortex-M0 since Qemu is too old
[rust.git] / src / test / codegen / sanitizer-memory-track-orgins.rs
1 // Verifies that MemorySanitizer track-origins level can be controlled
2 // with -Zsanitizer-memory-track-origins option.
3 //
4 // needs-sanitizer-support
5 // only-linux
6 // only-x86_64
7 // revisions:MSAN-0 MSAN-1 MSAN-2
8 //
9 //[MSAN-0] compile-flags: -Zsanitizer=memory
10 //[MSAN-1] compile-flags: -Zsanitizer=memory -Zsanitizer-memory-track-origins=1
11 //[MSAN-2] compile-flags: -Zsanitizer=memory -Zsanitizer-memory-track-origins
12
13 #![crate_type="lib"]
14
15 // MSAN-0-NOT: @__msan_track_origins
16 // MSAN-1:     @__msan_track_origins = weak_odr local_unnamed_addr constant i32 1
17 // MSAN-2:     @__msan_track_origins = weak_odr local_unnamed_addr constant i32 2
18 //
19 // MSAN-0-LABEL: define void @copy(
20 // MSAN-1-LABEL: define void @copy(
21 // MSAN-2-LABEL: define void @copy(
22 #[no_mangle]
23 pub fn copy(dst: &mut i32, src: &i32) {
24     // MSAN-0-NOT: call i32 @__msan_chain_origin(
25     // MSAN-1-NOT: call i32 @__msan_chain_origin(
26     // MSAN-2:     call i32 @__msan_chain_origin(
27     *dst = *src;
28 }