blob: 106dc6466d6a2654d19247fbc60de12ffc1a3f8d [file] [log] [blame]
//@ needs-sanitizer-support
//@ needs-sanitizer-address
//@ ignore-cross-compile
//
//@ compile-flags: -Zsanitizer=address
//@ run-fail-or-crash
//@ 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);
}
}