rust/tests/fail/intrinsics/ptr_offset_overflow.rs

6 lines
167 B
Rust
Raw Normal View History

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