2021-03-25 06:44:30 -05:00
|
|
|
// Some optimizations remove ZST accesses, thus masking this UB.
|
|
|
|
// compile-flags: -Zmir-opt-level=0
|
|
|
|
|
2018-09-15 09:35:37 -05:00
|
|
|
fn main() {
|
|
|
|
// This pointer *could* be NULL so we cannot load from it, not even at ZST
|
|
|
|
let ptr = (&0u8 as *const u8).wrapping_sub(0x800) as *const ();
|
2021-07-15 13:33:08 -05:00
|
|
|
let _x: () = unsafe { *ptr }; //~ ERROR out-of-bounds
|
2018-09-15 09:35:37 -05:00
|
|
|
}
|