blob: de63eea194ba989e924422fc1eda5a27a7d56a85 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
// 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);
}
}
|