2021-03-25 12:44:30 +01:00
|
|
|
// Some optimizations remove ZST accesses, thus masking this UB.
|
2022-07-08 16:08:32 +00:00
|
|
|
//@compile-flags: -Zmir-opt-level=0
|
2021-03-25 12:44:30 +01:00
|
|
|
|
2018-09-15 16:35:37 +02: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 ();
|
2022-07-11 11:44:55 +00:00
|
|
|
let _x: () = unsafe { *ptr }; //~ ERROR: out-of-bounds
|
2018-09-15 16:35:37 +02:00
|
|
|
}
|