]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/sanitizer-memory-track-orgins.rs
Suggest defining type parameter when appropriate
[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 MSAN-1-LTO MSAN-2-LTO
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 //[MSAN-1-LTO] compile-flags: -Zsanitizer=memory -Zsanitizer-memory-track-origins=1 -C lto=fat
13 //[MSAN-2-LTO] compile-flags: -Zsanitizer=memory -Zsanitizer-memory-track-origins -C lto=fat
14
15 #![crate_type="lib"]
16
17 // MSAN-0-NOT: @__msan_track_origins
18 // MSAN-1:     @__msan_track_origins = weak_odr local_unnamed_addr constant i32 1
19 // MSAN-2:     @__msan_track_origins = weak_odr local_unnamed_addr constant i32 2
20 // MSAN-1-LTO: @__msan_track_origins = weak_odr local_unnamed_addr constant i32 1
21 // MSAN-2-LTO: @__msan_track_origins = weak_odr local_unnamed_addr constant i32 2
22 //
23 // MSAN-0-LABEL: define void @copy(
24 // MSAN-1-LABEL: define void @copy(
25 // MSAN-2-LABEL: define void @copy(
26 #[no_mangle]
27 pub fn copy(dst: &mut i32, src: &i32) {
28     // MSAN-0-NOT: call i32 @__msan_chain_origin(
29     // MSAN-1-NOT: call i32 @__msan_chain_origin(
30     // MSAN-2:     call i32 @__msan_chain_origin(
31     *dst = *src;
32 }