mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-09 16:37:36 +00:00
9 lines
266 B
Rust
9 lines
266 B
Rust
//error-pattern: overflowing math on a pointer
|
|
fn main() {
|
|
let v = [1i8, 2];
|
|
let x = &v[1] as *const i8;
|
|
// One of them is guaranteed to overflow
|
|
let _ = unsafe { x.offset(isize::max_value()) };
|
|
let _ = unsafe { x.offset(isize::min_value()) };
|
|
}
|