2021-03-25 06:44:30 -05:00
|
|
|
// Some optimizations remove ZST accesses, thus masking this UB.
|
|
|
|
// compile-flags: -Zmir-opt-level=0
|
|
|
|
|
2021-04-15 03:00:39 -05:00
|
|
|
#[allow(deref_nullptr)]
|
2018-09-15 09:35:37 -05:00
|
|
|
fn main() {
|
2021-07-15 13:33:08 -05:00
|
|
|
let x: () = unsafe { *std::ptr::null() }; //~ ERROR dereferencing pointer failed: 0x0 is not a valid pointer
|
2018-09-15 09:35:37 -05:00
|
|
|
panic!("this should never print: {:?}", x);
|
|
|
|
}
|