]> git.proxmox.com Git - rustc.git/blame - tests/codegen/issues/issue-73827-bounds-check-index-in-subexpr.rs
Update upstream source from tag 'upstream/1.70.0+dfsg1'
[rustc.git] / tests / codegen / issues / issue-73827-bounds-check-index-in-subexpr.rs
CommitLineData
29967ef6
XL
1// This test checks that bounds checks are elided when
2// index is part of a (x | y) < C style condition
3
29967ef6
XL
4// compile-flags: -O
5
6#![crate_type = "lib"]
7
8// CHECK-LABEL: @get
9#[no_mangle]
10pub fn get(array: &[u8; 8], x: usize, y: usize) -> u8 {
11 if x > 7 || y > 7 {
12 0
13 } else {
14 // CHECK-NOT: panic_bounds_check
15 array[y]
16 }
17}