]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/sanitizer-recover.rs
Rollup merge of #68984 - ecstatic-morse:const-u8-is-ascii, r=sfackler
[rust.git] / src / test / codegen / sanitizer-recover.rs
1 // Verifies that AddressSanitizer and MemorySanitizer
2 // recovery mode can be enabled with -Zsanitizer-recover.
3 //
4 // needs-sanitizer-support
5 // only-linux
6 // only-x86_64
7 // revisions:ASAN ASAN-RECOVER MSAN MSAN-RECOVER MSAN-RECOVER-LTO
8 // no-prefer-dynamic
9 //
10 //[ASAN]             compile-flags: -Zsanitizer=address
11 //[ASAN-RECOVER]     compile-flags: -Zsanitizer=address -Zsanitizer-recover=address
12 //[MSAN]             compile-flags: -Zsanitizer=memory
13 //[MSAN-RECOVER]     compile-flags: -Zsanitizer=memory  -Zsanitizer-recover=memory
14 //[MSAN-RECOVER-LTO] compile-flags: -Zsanitizer=memory  -Zsanitizer-recover=memory -C lto=fat
15 //
16 // MSAN-NOT:         @__msan_keep_going
17 // MSAN-RECOVER:     @__msan_keep_going = weak_odr {{.*}} constant i32 1
18 // MSAN-RECOVER-LTO: @__msan_keep_going = weak_odr {{.*}} constant i32 1
19
20 // ASAN-LABEL: define i32 @penguin(
21 // ASAN:         call void @__asan_report_load4(i64 %0)
22 // ASAN:         unreachable
23 // ASAN:       }
24 //
25 // ASAN-RECOVER-LABEL: define i32 @penguin(
26 // ASAN-RECOVER:         call void @__asan_report_load4_noabort(
27 // ASAN-RECOVER-NOT:     unreachable
28 // ASAN:               }
29 //
30 // MSAN-LABEL: define i32 @penguin(
31 // MSAN:         call void @__msan_warning_noreturn()
32 // MSAN:         unreachable
33 // MSAN:       }
34 //
35 // MSAN-RECOVER-LABEL: define i32 @penguin(
36 // MSAN-RECOVER:         call void @__msan_warning()
37 // MSAN-RECOVER-NOT:     unreachable
38 // MSAN-RECOVER:       }
39 //
40 // MSAN-RECOVER-LTO-LABEL: define i32 @penguin(
41 // MSAN-RECOVER-LTO:          call void @__msan_warning()
42 // MSAN-RECOVER-LTO-NOT:      unreachable
43 // MSAN-RECOVER-LTO:       }
44 //
45 #[no_mangle]
46 pub fn penguin(p: &mut i32) -> i32 {
47     *p
48 }
49
50 fn main() {}