rust/tests/compile-fail/intptrcast_null_pointer_deref.rs

7 lines
193 B
Rust
Raw Normal View History

// compile-flags: -Zmiri-seed=0000000000000000
fn main() {
let x: i32 = unsafe { *std::ptr::null() }; //~ ERROR invalid use of NULL pointer
panic!("this should never print: {}", x);
}