mirror of
https://github.com/rust-lang/rust.git
synced 2025-12-01 05:28:04 +00:00
Most of these regressions concern elimination of panics and bounds checks that were fixed upstream by LLVM.
14 lines
344 B
Rust
14 lines
344 B
Rust
// Tests that no bounds check panic is generated for `j` since
|
|
// `j <= i < data.len()`.
|
|
|
|
//@ compile-flags: -Copt-level=3
|
|
|
|
#![crate_type = "lib"]
|
|
|
|
// CHECK-LABEL: @issue_80075
|
|
#[no_mangle]
|
|
pub fn issue_80075(data: &[u8], i: usize, j: usize) -> u8 {
|
|
// CHECK-NOT: panic_bounds_check
|
|
if i < data.len() && j <= i { data[j] } else { 0 }
|
|
}
|