mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-19 18:34:08 +00:00

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.
20 lines
399 B
Rust
20 lines
399 B
Rust
//@ needs-sanitizer-support
|
|
//@ needs-sanitizer-address
|
|
//@ ignore-cross-compile
|
|
//
|
|
//@ compile-flags: -Zsanitizer=address
|
|
//@ 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);
|
|
}
|
|
}
|