2019-11-15 00:00:00 +00:00
|
|
|
// Verifies that AddressSanitizer and MemorySanitizer
|
|
|
|
// recovery mode can be enabled with -Zsanitizer-recover.
|
|
|
|
//
|
2020-06-05 00:00:00 +00:00
|
|
|
// needs-sanitizer-address
|
|
|
|
// needs-sanitizer-memory
|
2020-01-21 00:00:00 +00:00
|
|
|
// revisions:ASAN ASAN-RECOVER MSAN MSAN-RECOVER MSAN-RECOVER-LTO
|
|
|
|
// no-prefer-dynamic
|
2019-11-15 00:00:00 +00:00
|
|
|
//
|
2022-12-30 20:11:30 +00:00
|
|
|
//[ASAN] compile-flags: -Zsanitizer=address -Copt-level=0
|
|
|
|
//[ASAN-RECOVER] compile-flags: -Zsanitizer=address -Zsanitizer-recover=address -Copt-level=0
|
2020-01-21 00:00:00 +00:00
|
|
|
//[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
|
2020-03-03 00:00:00 +00:00
|
|
|
// MSAN-RECOVER: @__msan_keep_going = weak_odr {{.*}}constant i32 1
|
|
|
|
// MSAN-RECOVER-LTO: @__msan_keep_going = weak_odr {{.*}}constant i32 1
|
2019-11-15 00:00:00 +00:00
|
|
|
|
2022-12-30 20:11:30 +00:00
|
|
|
// ASAN-LABEL: define dso_local i32 @penguin(
|
2020-01-21 00:00:00 +00:00
|
|
|
// ASAN: call void @__asan_report_load4(i64 %0)
|
|
|
|
// ASAN: unreachable
|
|
|
|
// ASAN: }
|
|
|
|
//
|
2022-12-30 20:11:30 +00:00
|
|
|
// ASAN-RECOVER-LABEL: define dso_local i32 @penguin(
|
2020-01-21 00:00:00 +00:00
|
|
|
// ASAN-RECOVER: call void @__asan_report_load4_noabort(
|
|
|
|
// ASAN-RECOVER-NOT: unreachable
|
|
|
|
// ASAN: }
|
|
|
|
//
|
2022-12-30 14:55:05 +00:00
|
|
|
// MSAN-LABEL: define dso_local noundef i32 @penguin(
|
2020-06-26 01:52:41 +00:00
|
|
|
// MSAN: call void @__msan_warning{{(_with_origin_noreturn\(i32 0\)|_noreturn\(\))}}
|
2020-01-21 00:00:00 +00:00
|
|
|
// MSAN: unreachable
|
|
|
|
// MSAN: }
|
|
|
|
//
|
2022-12-30 14:55:05 +00:00
|
|
|
// MSAN-RECOVER-LABEL: define dso_local noundef i32 @penguin(
|
2020-06-26 01:52:41 +00:00
|
|
|
// MSAN-RECOVER: call void @__msan_warning{{(_with_origin\(i32 0\)|\(\))}}
|
2020-01-21 00:00:00 +00:00
|
|
|
// MSAN-RECOVER-NOT: unreachable
|
|
|
|
// MSAN-RECOVER: }
|
|
|
|
//
|
2022-12-30 14:55:05 +00:00
|
|
|
// MSAN-RECOVER-LTO-LABEL: define dso_local noundef i32 @penguin(
|
2020-06-26 01:52:41 +00:00
|
|
|
// MSAN-RECOVER-LTO: call void @__msan_warning{{(_with_origin\(i32 0\)|\(\))}}
|
2020-01-21 00:00:00 +00:00
|
|
|
// MSAN-RECOVER-LTO-NOT: unreachable
|
|
|
|
// MSAN-RECOVER-LTO: }
|
|
|
|
//
|
2019-11-15 00:00:00 +00:00
|
|
|
#[no_mangle]
|
|
|
|
pub fn penguin(p: &mut i32) -> i32 {
|
|
|
|
*p
|
|
|
|
}
|
2020-01-21 00:00:00 +00:00
|
|
|
|
|
|
|
fn main() {}
|