2024-05-20 14:22:49 -05:00
|
|
|
//@ compile-flags: -O
|
|
|
|
// This regress since Rust version 1.72.
|
|
|
|
//@ min-llvm-version: 18.1.4
|
|
|
|
|
|
|
|
#![crate_type = "lib"]
|
|
|
|
|
|
|
|
use std::convert::TryInto;
|
|
|
|
|
|
|
|
const N: usize = 24;
|
|
|
|
|
|
|
|
// CHECK-LABEL: @example
|
|
|
|
// CHECK-NOT: unwrap_failed
|
2024-06-09 08:25:12 -05:00
|
|
|
#[no_mangle]
|
2024-05-20 14:22:49 -05:00
|
|
|
pub fn example(a: Vec<u8>) -> u8 {
|
|
|
|
if a.len() != 32 {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
let a: [u8; 32] = a.try_into().unwrap();
|
|
|
|
|
|
|
|
a[15] + a[N]
|
|
|
|
}
|