rust/tests/fail/intrinsics/ptr_offset_overflow.rs
2022-07-25 10:24:19 -04:00

6 lines
167 B
Rust

fn main() {
let v = [1i8, 2];
let x = &v[1] as *const i8;
let _val = unsafe { x.offset(isize::MIN) }; //~ERROR: overflowing in-bounds pointer arithmetic
}