2022-07-05 04:15:22 -05:00
|
|
|
//@compile-flags: -Zmiri-permissive-provenance
|
2019-11-04 05:11:31 -06:00
|
|
|
|
2022-07-24 13:28:45 -05:00
|
|
|
#[rustfmt::skip] // fails with "left behind trailing whitespace"
|
2019-11-04 05:11:31 -06:00
|
|
|
fn main() {
|
|
|
|
let x = 0 as *mut i32;
|
|
|
|
let _x = x.wrapping_offset(8); // ok, this has no inbounds tag
|
|
|
|
let _x = unsafe { x.offset(0) }; // UB despite offset 0, NULL is never inbounds
|
2022-07-24 13:28:45 -05:00
|
|
|
//~^ERROR: null pointer is a dangling pointer
|
2019-11-04 05:11:31 -06:00
|
|
|
}
|