mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 06:22:00 +00:00
6d75f54310
Moves the sanitizer ui tests to the sanitizer directory and removes the sanitizer prefix from tests file names similarly to how the sanitizer codegen tests are organized.
28 lines
729 B
Rust
28 lines
729 B
Rust
// Regression test for sanitizer function instrumentation passes not
|
|
// being run when compiling with new LLVM pass manager and ThinLTO.
|
|
// Note: The issue occurred only on non-zero opt-level.
|
|
//
|
|
//@ needs-sanitizer-support
|
|
//@ needs-sanitizer-address
|
|
//@ ignore-cross-compile
|
|
//
|
|
//@ no-prefer-dynamic
|
|
//@ revisions: opt0 opt1
|
|
//@ compile-flags: -Zsanitizer=address -Clto=thin
|
|
//@[opt0]compile-flags: -Copt-level=0
|
|
//@[opt1]compile-flags: -Copt-level=1
|
|
//@ run-fail
|
|
//@ error-pattern: ERROR: AddressSanitizer: stack-use-after-scope
|
|
|
|
static mut P: *mut usize = std::ptr::null_mut();
|
|
|
|
fn main() {
|
|
unsafe {
|
|
{
|
|
let mut x = 0;
|
|
P = &mut x;
|
|
}
|
|
std::ptr::write_volatile(P, 123);
|
|
}
|
|
}
|