blob: 8a4ff16694bdb0c787c4f389bc356b4d9d9eb852 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
// run-pass
// compile-flags: -O
// Regression test for issue #80309
pub fn zero(x: usize) -> usize {
std::ptr::null::<i8>().wrapping_add(x) as usize - x
}
pub fn qux(x: &[i8]) -> i8 {
x[zero(x.as_ptr() as usize)]
}
fn main() {
let z = vec![42, 43];
println!("{}", qux(&z));
}
|