File: sanitizer-recover.rs

package info (click to toggle)
rustc-web 1.78.0%2Bdfsg1-2~deb11u3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,245,360 kB
  • sloc: xml: 147,985; javascript: 18,022; sh: 11,083; python: 10,265; ansic: 6,172; cpp: 5,023; asm: 4,390; makefile: 4,269
file content (50 lines) | stat: -rw-r--r-- 1,963 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Verifies that AddressSanitizer and MemorySanitizer
// recovery mode can be enabled with -Zsanitizer-recover.
//
//@ needs-sanitizer-address
//@ needs-sanitizer-memory
//@ revisions:ASAN ASAN-RECOVER MSAN MSAN-RECOVER MSAN-RECOVER-LTO
//@ no-prefer-dynamic
//
//@                   compile-flags: -Ctarget-feature=-crt-static
//@[ASAN]             compile-flags: -Zsanitizer=address -Copt-level=0
//@[ASAN-RECOVER]     compile-flags: -Zsanitizer=address -Zsanitizer-recover=address -Copt-level=0
//@[MSAN]             compile-flags: -Zsanitizer=memory
//@[MSAN-RECOVER]     compile-flags: -Zsanitizer=memory  -Zsanitizer-recover=memory
//@[MSAN-RECOVER-LTO] compile-flags: -Zsanitizer=memory  -Zsanitizer-recover=memory -C lto=fat
//
// MSAN-NOT:         @__msan_keep_going
// MSAN-RECOVER:     @__msan_keep_going = weak_odr {{.*}}constant i32 1
// MSAN-RECOVER-LTO: @__msan_keep_going = weak_odr {{.*}}constant i32 1

// ASAN-LABEL: define dso_local i32 @penguin(
// ASAN:         call void @__asan_report_load4(i64 %0)
// ASAN:         unreachable
// ASAN:       }
//
// ASAN-RECOVER-LABEL: define dso_local i32 @penguin(
// ASAN-RECOVER:         call void @__asan_report_load4_noabort(
// ASAN-RECOVER-NOT:     unreachable
// ASAN:               }
//
// MSAN-LABEL: define dso_local noundef i32 @penguin(
// MSAN:         call void @__msan_warning{{(_with_origin_noreturn\(i32 0\)|_noreturn\(\))}}
// MSAN:         unreachable
// MSAN:       }
//
// MSAN-RECOVER-LABEL: define dso_local noundef i32 @penguin(
// MSAN-RECOVER:         call void @__msan_warning{{(_with_origin\(i32 0\)|\(\))}}
// MSAN-RECOVER-NOT:     unreachable
// MSAN-RECOVER:       }
//
// MSAN-RECOVER-LTO-LABEL: define dso_local noundef i32 @penguin(
// MSAN-RECOVER-LTO:          call void @__msan_warning{{(_with_origin\(i32 0\)|\(\))}}
// MSAN-RECOVER-LTO-NOT:      unreachable
// MSAN-RECOVER-LTO:       }
//
#[no_mangle]
pub fn penguin(p: &mut i32) -> i32 {
    *p
}

fn main() {}